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
Create a class called Clock to represent a Clock. It should have three private instance variables: An int for the hours, an int
Anvisha [2.4K]

Answer:

public class Clock

{

private int hr; //store hours

private int min;  //store minutes

private int sec; //store seconds

public Clock ()

{

 setTime (0, 0, 0);

}

public Clock (int hours, int minutes, int seconds)

{

 setTime (hours, minutes, seconds);

}

public void setTime (int hours, int minutes, int seconds)

{

 if (0 <= hours && hours < 24)

      hr = hours;

 else

      hr = 0;

 

 if (0 <= minutes && minutes < 60)

      min = minutes;

 else

      min = 0;

 

 if (0 <= seconds && seconds < 60)

      sec = seconds;

 else

      sec = 0;

}

 

 //Method to return the hours

public int getHours ( )

{

 return hr;

}

 //Method to return the minutes

public int getMinutes ( )

{

 return min;

}

 //Method to return the seconds

public int getSeconds ( )

{

 return sec;

}

public void printTime ( )

{

 if (hr < 10)

      System.out.print ("0");

 System.out.print (hr + ":");

 if (min < 10)

      System.out.print ("0");

 System.out.print (min + ":");

 if (sec < 10)

      System.out.print ("0");

 System.out.print (sec);

}

 

 //The time is incremented by one second

 //If the before-increment time is 23:59:59, the time

 //is reset to 00:00:00

public void incrementSeconds ( )

{

 sec++;

 

 if (sec > 59)

 {

  sec = 0;

  incrementMinutes ( );  //increment minutes

 }

}

 ///The time is incremented by one minute

 //If the before-increment time is 23:59:53, the time

 //is reset to 00:00:53

public void incrementMinutes ( )

{

 min++;

 

if (min > 59)

 {

  min = 0;

  incrementHours ( );  //increment hours

 }

}

public void incrementHours ( )

{

 hr++;

 

 if (hr > 23)

     hr = 0;

}

public boolean equals (Clock otherClock)

{

 return (hr == otherClock.hr

  && min == otherClock.min

   && sec == otherClock.sec);

}

}

3 0
3 years ago
What tool can help discover and report computer errors and conflicts that occur when you first turn on a computer and before the
Morgarella [4.7K]

The answer is a POST Diagnostic Card.

Although not a necessity, a POST card can help discover and report computer errors and conflicts that occur when you first turn on a computer and before the operating system. To be able to understand how a POST card works, one needs to be very familiar with the BIOS. The power-on self test (POST) is a series of various tests performed by a computer when you turn it on. If you have any issues that conflicts with the operating system and prevents the computer from booting, you can install a POST card in the available expansion slots. This card will monitor the entire boot process and report errors in coded numbers on a small LED panel on the card.  

6 0
3 years ago
Kelly is a college sophomore majoring in computer science. She is interested in gaining exposure to the most useful and current
Nuetrik [128]

Answer:

Java

Explanation:

Java is a general-purpose programming language that is object-oriented, and has strong support for web development.

Therefore, one of the languages that a college sophomore majoring computer science learn is <u>Java,</u> an object-oriented programming language that is commonly used to write Web applications.

6 0
3 years ago
If the wrong server edition is installed, what command can be used to change to a different edition?​
nekit [7.7K]
Dism because it is used to change and service programs
6 0
3 years ago
Write a statement that increments numUsers if updateDirection is 1, otherwise decrements numUsers. Ex: if numUsers is 8 and upda
Lady_Fox [76]

Answer:

Following are the statement is given below

if(updateDirection ==1) // check condition

{

++numUsers; // increments the value

}

else

{

--numUsers; // decrement the value

}

Explanation:

Following are the description of statement

  • Check the condition in the if block .If the "updateDirection" variable is 1 then then control moves to the if block otherwise control moves to the else block statement.
  • In the if  block the statement is "++numUsers" it means it increment the value by 1 .
  • In the else block the statement is "--numUsers" it means it decrement  the value by 1 .

4 0
3 years ago
Other questions:
  • Which is a credit card balance A. The amount of interest you must pay the credit card company B. The required minimum payment to
    5·1 answer
  • What kind of website uses keywords to locate content?
    15·1 answer
  • 120
    14·1 answer
  • I need some asap pls
    9·2 answers
  • Match the hardware device with the "category" into which it falls. Remember to choose
    8·1 answer
  • Universal containers set the organization-wide defaults for cases to private. When a case is escalated, case ownership changes t
    13·1 answer
  • Which visual aids can be used to present large amounts of numerical data from multiple sources? Check all that apply.
    7·1 answer
  • Subscribe to my you tube channel to get all your questions answered
    8·1 answer
  • Identify the parts of it, Give at least three web browser that you usually used to visit a website.​
    10·1 answer
  • Think of some local businesses that have websites. Look online and identify two different websites for businesses or services in
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!