EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 6, Problem 12PE

Explanation of Solution

Program:

File name: “Population.java

//Define a class named Population

public class Population

{

    //Define main method

    public static void main(String[] args)

    {

        //Declare variables and initialize the values

        //set growth rate in percent

        double RATE_OF_GROWTH_OF_MEXICO=0.0101;

        //set decay rate in percent

        double RATE_OF_DECAY_OF_USA=0.0015;

        //set years

        int years=1;

        //Set Mexico population as 128 million

        double mexicoPopulation=128000000;

        //Set USA population as 323 million

        double usaPopulation=323000000;

        //Print the result

System.out.printf("%-10s%-20s%-15s\n","Years","Mexico","USA");

        /*While condition that checks if the Mexico

        population is less than USA population */

        while (mexicoPopulation<usaPopulation)

        {

            //Print the result

System...

Blurred answer
Students have asked these similar questions
Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average.
Write an application to calculate how many days it is fromtoday until the end of the current year. Save the file asDaysYear.java.
** THE CODE SHOULD BE IN JAVA** 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
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY