Question

In: Computer Science

Assume that the population of Mexico is 128 million and that the population increases 1.01 percent...

Assume that the population of Mexico is 128 million and that the population increases 1.01 percent annually. Assume that the population of the United States is 323 million and that the population is reduced 0.15 percent annually.

Write an application that displays the populations for the two countries every year until the population of Mexico exceeds that of the United States, and display The population of Mexico will exceed the U.S. population in X years

public class Population
{
public static void main(String[] args)
{
double mexicoPop = 128;
double usPop = 323;
int year = 0;
  
// your code here

System.out.println("The population of Mexico will exceed the U.S. population in " + year + " years");
System.out.println("The population of Mexico will be " + mexicoPop + " million");
System.out.println("and the population of the U.S. will be " + usPop + " million");
}
}

Solutions

Expert Solution

Solution:

public class Population {
    public static void main(String[] args) {
        double mexicoPop = 128;
        double usPop = 323;
        int year = 0;

        //Core logic begins
        while (mexicoPop < usPop) {
            mexicoPop = mexicoPop + (1.01 / 100) * mexicoPop;
            usPop = usPop - (0.15 / 100) * usPop;
            year = year + 1;
        }
        //Core logic ends
        System.out.println("The population of Mexico will exceed the U.S. population in " + year + " years");
        System.out.println("The population of Mexico will be " + mexicoPop + " million");
        System.out.println("and the population of the U.S. will be " + usPop + " million");
    }
}

Output:


Related Solutions

1)Suppose that inflation in the US is 2 percent and 10 percent in Mexico. Suppose Mexico...
1)Suppose that inflation in the US is 2 percent and 10 percent in Mexico. Suppose Mexico is expected to experience a 5% real depreciation against the US. What is the expected rate of nominal appreciation or depreciation of the peso relative to the dollar? 2) Consider a world with two countries, the United States and Europe.Prices are perfectly flexible and APPP holds at all times. The money supply at this moment in the United States is $1,000,000, real output in...
Assume that you have $100 million dollars to invest in Mexico. Explain where and how you...
Assume that you have $100 million dollars to invest in Mexico. Explain where and how you would invest this capital. What industry would you choose to invest in? How would you structure the investment (new venture, purchase an existing business, joint venture, etc.) Assume that you are presenting to prospective shareholders in your investment company. What factors will influence the expected return on your investment? Present an optimistic scenario, realistic scenario, and pessimistic scenario.
Sora Industries has 67 million outstanding shares, $128 million in debt, $55 million in cash, and...
Sora Industries has 67 million outstanding shares, $128 million in debt, $55 million in cash, and the following projected free cash flow for the next four years: Year 0 1 2 3 4 Earnings and FCF Forecast ($ million) 1 Sales 433.0 468.0 516.0 547.0 574.3 2 Growth vs. Prior Year 8.1% 10.3% 6.0% 5.0% 3 Cost of Goods Sold (313.6) (345.7) (366.5) (384.8) 4 Gross Profit 154.4 170.3 180.5 189.5 5 Selling, General, & Admin. (93.6) (103.2) (109.4) (114.9)...
In 2016, 59.7 percent of the adult population (253 million) was employed. If the employment rate increased to 62 percent,
In 2016, 59.7 percent of the adult population (253 million) was employed. If the employment rate increased to 62 percent,Instructions: In part a, round your response to one decimal place. In part b, enter your response as a whole number.a. How many more people would be working?______ millionb. By how much would output increase if per worker GDP were $122,000?$ _____ billion
Ozone Population 126 0.6 135 3.9 124 0.2 128 0.5 130 2.3 128 0.7 126 1.1...
Ozone Population 126 0.6 135 3.9 124 0.2 128 0.5 130 2.3 128 0.7 126 1.1 We wish to study the effect that the size of various U.S. cities have over ozone concentrations. The size of the populations correspond to the last census (in millions of inhabitants), and the average quantity of ozone per hour was determined in (parts per thousand millions); a) Identify the variables X and Y and analyze if the variables are linearly related. b) Determine the...
A population has a mean of 128 and a standard deviation of 32. Suppose a sample...
A population has a mean of 128 and a standard deviation of 32. Suppose a sample of size 64 is selected and x is used to estimate μ. (Round your answers to four decimal places.) (a) What is the probability that the sample mean will be within ±5 of the population mean?
A population has a mean of 128 and a standard deviation of 32. Suppose a sample...
A population has a mean of 128 and a standard deviation of 32. Suppose a sample of size 64 is selected and x is used to estimate μ. (Round your answers to four decimal places.) (a) What is the probability that the sample mean will be within ±5 of the population mean? (b) What is the probability that the sample mean will be within ±10 of the population mean?
A population has a mean of 128 and a standard deviation of 32. Suppose a sample...
A population has a mean of 128 and a standard deviation of 32. Suppose a sample of size 64 is selected and x is used to estimate μ. (Round your answers to four decimal places.) (a) What is the probability that the sample mean will be within ±5 of the population mean? (b) What is the probability that the sample mean will be within ±10 of the population mean? You may need to use the appropriate appendix table or technology...
Assume that $1.4 million is deposited into a bank with a reserve requirement of 15 percent....
Assume that $1.4 million is deposited into a bank with a reserve requirement of 15 percent. Instructions: Round your answer to two decimal places. a. What is the money supply as a result?      b. If the government decides to raise the reserve requirement to 20 percent, what is the value of the money supply in this case?    
4.Assume that more corn is needed because population increases as time passes. Does the share of...
4.Assume that more corn is needed because population increases as time passes. Does the share of total output received by landlords increase, decrease, or remain the same as population increases? Explain your answer. 5.Does the share of total output (or income) received by owners of capital increase, decrease, or remain the same as population increases? Explain your answers. 6. According to Ricardo, will the rate of profit on the poorest grade of farmed land be lower than the rate of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT