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
why is it important for you to understand and describe the internal and external components of a computer in the workplace​
zhannawk [14.2K]

Hi! I have been troubleshooting and building PCs all my life and I find it very important to know the the internal core components of a PC and how they function that way when errors occur you can attempt to fix the problem.

Ex1: Lets say your BIOS identifies a problem with a RAM slot you would be able to know that your RAM slot is either shorted or there is a problem with the RAM stick you inserted.

Ex2: Now your monitor is flashing and turning colors randomly. You could make an inference that either your monitor is prongs are broken, your cable prongs could be bent, your cable might not be plugged in all the way, or your external or integrated GPU is toast.

Hope this might've showed you something

Aaron

7 0
3 years ago
Para que se emplean los operando en una formula
sergejj [24]

Explanation:

what are you mobile-gws-wiz-serp now and black and son in a new medicine that is not the only way that we know you are in a

4 0
3 years ago
What are the benefits of writing functions that use parameters and return List 2 please and explain what is return
Ratling [72]

<u>Answer and explanation:</u>

There are many benefits of writing functions that use parameters and return. Some of them are:

1. Flexibility: With functions having parameters, several values of the parameters can be used at invocation time thereby making the application flexible. For example, given the following function in Java.

<em>public void showName(String name){</em>

<em>    System.out.println("Your name is " + name);</em>

<em>}</em>

To call this method (function), the programmer could use various values for the name parameter used in the function like so:

showName("John");

showName("Doe");

If the function didn't have a parameter, it is possible it will only print a hardcoded name every time the function is called.

2. Scope Control: When a function is allowed to return a value, it helps to work around scope issues since variables declared within a function are limited to that function and do not exist outside the function. This means that the values of these variables cannot be used anywhere else outside the function in which they are being declared. However, if the function returns a value, the value can be used anywhere else in the program.

For example:

<em>public String getDouble(int x){</em>

<em>    int y = x * 2</em>

<em>    return y;</em>

<em>}</em>

The function above returns twice the value of the argument supplied to it. Since the integer variable y is declared within the function, it's value cannot be used outside the function. However, since the value is being returned by the function, it could be used anywhere the function is being called. Thanks to the return keyword.

3 0
3 years ago
All slide layouts have a content placeholder.
Mars2501 [29]
True, but the only way to get these constant place holders is of you program them in, in other words you have to tell the computer that you want them.
8 0
3 years ago
When working with numerical data and creating charts, it makes sense to use microsoft: power point. word. access. excel.?
Gekata [30.6K]
I'd personally use word!!!
6 0
3 years ago
Other questions:
  • Which one is it A,B,C,D
    10·2 answers
  • You must create an instructional video for your company and are required to ensure it is compatible with your company's windows
    6·1 answer
  • Jim has excellent oral and written communication skills. He enjoys public speaking and wants a job in which he will interact wit
    10·2 answers
  • There is a concern to be had about the quality of information found on the internet.
    10·2 answers
  • Write a program to calculate student's average test scores and the grade. You may assume the following input data:
    9·1 answer
  • A call center is a _______.<br><br> JIT<br><br> CMA<br><br> CIC<br><br> SFA
    8·1 answer
  • If you're under 18 and you receive _____ or more license points in 12 months, you'll be restricted to driving only to school or
    11·1 answer
  • Hope fixes her mistake and comes up with this list.
    9·2 answers
  • Which element adds a “page turn” effect to the slides in a presentation?
    13·2 answers
  • sam is a member of a software development team. his job is to identify the system functions that must be validated, and to decid
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!