Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume that the population of Mexico is 114 million and that the population incr

ID: 3543778 • Letter: A

Question

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. Write an application that displays the populations for the two countries every year until the population of Mexico excceds that of the United States, and display the number of years it took. Save file as Population.java.

***NOTE**** This is my first class of java the program that I have to write has to be of what we have learned in the last 6 chapters it cannot have stuff that is way more advanced than the first 6 chapters.

Explanation / Answer

Loop until Mexicans have more people than Americans.

public class Population{
public static void main(String[] args){
??double mexico = 114;
??double usa = 312;
??double mexicoRate = .0101;
??double usaRate = .0015;
??while (usa>mexico){
????System.out.println("Mexico's population > " + mexico + "million");
????System.out.println("USA's population > " + usa + "million");
????mexico+=mexico*mexicoRate;
????usa-=usa*usaRate;
??}
?}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote