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
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.
Write an application that determines whether a phrase entered by the user is a palindrome. A palindrome is a phrase that reads the same backward and forward without regarding capitalization, spaces or punctuation. And it will allow the user to enter as many phrases as he likes after each iteration.
Create an application for generating lottery tickets of random numbers. Each lottery ticket has a fixed count of numbers to be played with each number selected being within a given range.  For example, when the range of numbers is 1 through 100, and 5 numbers are to be played, the lottery ticket will be composed of 5 unique values between 1 and 100.  The values are selected at random. The main function is responsible for obtaining the upper range of the numbers and the count of numbers to be played from the end user.  The count of numbers must be less than the upper range.  The main function will call the generateLotto function to generate the lottery ticket and then call the displayTicket function to display the resulting lottery ticket.  Any number of lottery tickets may be generated. The generateLotto function should accept two parameters. The first should be the upper range for the numbers while the second parameter represents a count of the numbers to be played. For example,…
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