Java Programming, Loose-leaf Version
Java Programming, Loose-leaf Version
8th Edition
ISBN: 9781337685917
Author: Joyce Farrell
Publisher: Cengage Learning
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
using java (Use the Date class) Write a program that creates a Date object, sets its elapsedtime to 10000, 100000, 1000000, 10000000, 100000000, 1000000000,10000000000, and 100000000000, and displays the date and time using thetoString() method, respectively.
Make a Java Application for a company that will provide the following information: - total number of male employees; - total number of female employees; - total male employees who are single and less than 25 years old; - total female employees who are single and less than 22 years old; - average age of all married male employees; and - average age of all married female employees (Show your complete Java code)
Do in Java language, filename wealth.java
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.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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