1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sophie [7]
3 years ago
7

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

ulation 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
Computers and Technology
1 answer:
horrorfan [7]3 years ago
6 0

Answer:

//Define class

public class Main {

 //define main method

 public static void main(String[] args)  

 {

   //declare and initialize the double type variable to 128

   double mexico = 128;

   //declare and initialize the double type variable to 323

   double us = 323;

   //declare and initialize the integer type variable to 0  

   int yr = 0;

   //set the while loop to check which is greater

   while (mexico < us)  

   {

     //increment in the variable by 1

     yr++;

     //initialize in the variables acc. to the percentage

     mexico *= 1.0101;

     us *= 0.9985;

   }

   //print the following results

   System.out.println("Population of the Mexico will be exceed the population U.S. in " + yr + " years");

   System.out.println("Population of the Mexico will be " + mexico + " million");

   System.out.println("and population of the U.S. will be " + us + " million");

 }

}

<u>Output</u>:

Population of the Mexico will be exceed the population U.S. in81 years

Population of the Mexico will be 288.88435953355025 million

and population of the U.S. will be 286.0198193927948 million

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, we define the class 'Main' and inside it, we define the main method.
  • Then, declare two double data type variables which are 'mexico' and 'us' and initialize in it to 128 and 323.
  • Declare integer data type variable 'yr' and initialize in it to 0.
  • Set the while loop and pass the condition to check that the variable 'mexico' is less than the variable 'us' then, increment in the variable 'yr' by 1 and multiply the variables 'us' and 'mexico' by the following percentage.
  • Finally, print the following results with the message.
You might be interested in
The numbers on the bottom of a typical check represent all of the following EXCEPT
Phantasy [73]
<span>These numbers indicate the account a check is drawn on and from which bank.</span>
5 0
3 years ago
What is the advantage of maintaining a list of keywords while creating a design blueprint?
elixir [45]

Creating a list of keywords and using them throughout your site helps move pages up the ranks of search engines like Bing or Google. They also attract website visitors. Technically, maintaining a list of keywords while creating a webpage is important in search engine optimization.






8 0
3 years ago
Read 2 more answers
NEED HELP PLEASE-
zysi [14]

Answer:i believe it is patents. i could be wrong

Explanation:

To protect your interests, consider two common strategies employed by inventors, amateur and professional alike. First, you can file a provisional patent application (if your invention is patent able)

5 0
3 years ago
Read 2 more answers
What connects two or more LANs together?
boyakko [2]
Wide Area Network also known as WAN
3 0
3 years ago
Read 2 more answers
QUESTION 1
slava [35]
Answer is Bit defender Internet security
B
6 0
2 years ago
Other questions:
  • Provide Java code to illustrate how to create an array, reference an array, and address an element of an array.
    13·1 answer
  • Which of the following statements is true of ASCII code?
    12·1 answer
  • Can anybody come up with a catchy title for this?
    11·1 answer
  • Emotional intelligence is a new term to describe personal traits ?
    12·1 answer
  • This program has some errors in it that are needed to be checked import java.io.*;
    13·1 answer
  • Write a Student class in Java which has a name, id_number, year (e.g. 2) and
    9·1 answer
  • A healthcare organization received notification that a hospital employee’s laptop that contained PHI was inadvertently left at a
    14·1 answer
  • Write the importance of program in computer​
    9·1 answer
  • Can you exclude header rows from sort in excel?
    8·1 answer
  • Differenciate between foreign key and primary key in database.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!