Question

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

Assume that the population of Mexico is 128 million and that the population increases 1.01 percentannually. 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. This is JAVA prog. Pls help

Here is provided code:

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

while (mexicoPop < usPop) {
year++;
mexicoPop *= 1.0101;
usPop *= 0.9985;
}

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");
}
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class Population {
    public static void main(String[] args) {
        double mexicoPop = 128, usPop = 323;
        int year = 0;
        while (mexicoPop < usPop) {
            year++;
            mexicoPop += (1.01 / 100) * mexicoPop;  // increases by 1.01 percent
            usPop -= (0.15 / 100) * usPop;  // decreases by 0.15 percent
        }
        System.out.println("The population of Mexico will exceed the U.S. population in " + year + " years.");
    }
}

Add a comment
Know the answer?
Add Answer to:
Assume that the population of Mexico is 128 million and that the population increases 1.01 percentannually....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 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...

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

    Assume that the population of Mexico is 114 million and that the population increases 1.01 percent annually. Assume that the population of the United States is 312 million and that the population is reduced 0.15 percent annually. Assume that the population of Japan is 125 million and that the population increases 1.00 percent annually. Write an application that displays the populations for the three countries every year until the population of Mexico exceeds that of the United States. Display the...

  • Assume a world population of 7.3 billion and a U.S. population of 323 million. a. Look...

    Assume a world population of 7.3 billion and a U.S. population of 323 million. a. Look up the present total annual U.S. primary energy consumption. Then determine the total world energy consumption in quads if the rest of the world were to use the same per capita energy as in the United States b. If the energy source mix were to remain the same as the present mix in achieving the scenario of Part a, what would be the percentage...

  • The large wave of immigration from Mexico to the United States that began four decades ago,...

    The large wave of immigration from Mexico to the United States that began four decades ago, most of it unauthorized, has to a large degree ended. As a report from the Pew Hispanic Center confirms, net migration from Mexico to the United States sank to about zero in the past five years. Did the North American Free Trade Agreement (NAFTA) play a role? Yes and no. Actually, the number of Mexicans living illegally in the United States shot up from...

  • Question #1. Domestic mine production of copper in 2009 declined by about 9% to 1.2 million...

    Question #1. Domestic mine production of copper in 2009 declined by about 9% to 1.2 million tons and its value fell to about $6.2 billion. The principal mining States, in descending order of production— Arizona, Utah, New Mexico, Nevada, and Montana—accounted for more than 99% of domestic production; copper also was recovered at mines in Idaho and Missouri. Although copper was recovered at 29 mines operating in the United States, 20 mines accounted for about 99% of production. Recent assessments...

  • Part 1 In 1950 the U.S. had a population of 150 million and it was growing at 1.3% a year. Assume no net migration. (10...

    Part 1 In 1950 the U.S. had a population of 150 million and it was growing at 1.3% a year. Assume no net migration. (10 points total) a. In about how many years will it take for the U.S. population to double? (5 points) b. In 2010 U.S. population was 308 million. Calculate the average annual growth rate of the population over these 60 years. (5 points) Part 2 In year 1, a country has a population of 100 people;...

  • Real GDP in the United States was $17,688.89 billion in 2016 and $18,108.082 billion in 2017....

    Real GDP in the United States was $17,688.89 billion in 2016 and $18,108.082 billion in 2017. The total population of the United States was approximately 323.32 million in 2016 and increased to 325.42 million people in 2017. Calculate the total economic growth rate of the U.S. between 2016 and 2017. What was the rate of population increase between the two years? Calculate the levels of Real GDP per capita for the U.S. in 2016 and 2017. What was the growth...

  • Write a program to help answer questions like the following: Suppose the species Klingon ox has...

    Write a program to help answer questions like the following: Suppose the species Klingon ox has a population of 100 and a growth rate of 15 percent, and the species elephant has a population of 10 and a growth rate of 35 percent. How many years will it take for the elephant population to exceed the Klingon ox population? You can assume that this will happen within 10 years. Use the version of the class Species from Sakai’s Week 7...

  • CASE 12.2 The Price of Life In a surprising announcement, the world's second largest pharmaceutic...

    CASE 12.2 The Price of Life In a surprising announcement, the world's second largest pharmaceutical company, GlaxoSmithKline (GSK), announced that it would slash prices on the pharmaceuticals it sold in the world's poorest countries. The company challenged other pharmaceutical firms to do the same. Specifically, GSK declared that it would cut prices for all drugs in the 50 least developed countries to a level no higher than 25 percent of the price charged in the United States. The company also...

  • 1. Use the information in the following table to calculate: a. the adult population b. the...

    1. Use the information in the following table to calculate: a. the adult population b. the labor force c. the labor-force participation rate d. the unemployment rate Employed Unemployed Not in the labor force 142,263,000 10,112,000 82,932,000 2. Assume that the reserve requirement is 3 percent. All other equal, will the money supply expand more if the Federal Reserve buys $3,000 worth of bonds or if someone deposits in a bank $3,000 that he had been hiding in his cookie...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT