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...
Trending nowThis is a popular solution!
- 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,…arrow_forwardCreate 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,…arrow_forwardCreate 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,…arrow_forward
- use java : write an application that reads English-Language phrase and encodes it into morse code. also write an application that reads a phrase in morse code and converts it into the English-Language equivalent . Use one blank between each Morse-code letter and three blanks between each Morse-coded word.arrow_forwardTrainers at Tom's Athletic Club are encouraged to enroll new members. Write an application that extracts the names of Trainers and groups them based on the number of new members each trainer has enrolled this year. Output is the number of trainers who have enrolled 0 to 5 members, 6 to 12 members, 13 to 20 members, and more than 20 members. Give their names as well as the number of members they have enrolled. Use this list of trainers: {"Jake Butt", "Ziggy Hood", "Hroniss Grasu", "Vontaze Burfict", "Jaquiski Tartt","Ndamukong Suh", "Thurston Armbrister", "Captain Munnerlyn", "Barkevious Mingo", "Ha Ha Clinton-Dix","Mister Alexander", "BenJarvus Green-Ellis", "Richie Incognito", "Champ Bailey", "Captain Munnerlyn","Mike Kafka", "Ras-I Dowling", "Bryan Anger", "D'Brickashaw Ferguson", "Rex Hadnot","Sage Rosenfels", "Robert Griffin III", "Sav Rocca", "Chad Ochocinco", "Brett Rypien"} Use this list of the number of members each trainer has enrolled: {3, 9, 13, 26, 23,19, 15, 13, 17,…arrow_forwardMake 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)arrow_forward
- 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.arrow_forwardONLY IN JAVA. Create a Java program that you can play the game "More or Less, Less is More."Rules of the game:The two-dimensional field of the game must be m x n in size (game field). The buttons that make up the game field each have a number assigned to them.beginning of the game:The target value is shown above the game field. The numbers on the buttons of the game field are set to a random digit between 0 and 9.• Below the game field, you may read the current sum of the numbers displayed on the buttons.• Above the playing field in the upper right corner is a display of the remaining movements.Playing: The player chooses their first move by clicking any button (button A) on the playing area.1. The player has the option to select a second button (button B) that is situated in the same row or column as the first button they chose (A).2. When button (A) is clicked, value is changed in accordance with the following formula: (AoperationB)mod10 equals A.3. The basic game's operation will be…arrow_forwardjava Alejandro has many emails, but only has time to read a few of them. Help him sort his inbox by checking the given email variable for his name and for the word 'project'. Use the following requirements to help Alejandro: If the email has his name and the word 'project' print: priority If the email has only his name, but not the word 'project' print: read If the email does not have his name print: don't readarrow_forward
- This program uses Java. You will be making a general class that will be called “GeneralBusiness”. This class must have the following methods: selectSalesTax() – This method will read in a file “stateTaxInfo.txt” that has the name of a state and the tax percentage (decimal form) for that state and save them to the given arrays. It will then print a menu for the user to choose the state that the business is in and set the variables to hold the values. getCustomerName() – This method will prompt the user for the name of the person using the program calcSalesTax() – This method will be sent a subtotal and calculate the sales tax outputReceipt() – This method will output a generic receipt as follows: Subtotal $37.50 Sales Tax $2.44 Total $39.94 outputMenu() - This method will receive the number of items and output a generic menu as follows: Item 1 Item 2 Item 3 Item 4 must have the following variables: stateNames - array saleTax – array saleTaxAmount theStateName subtotal total firstName…arrow_forwardHelp with JavaFX barchart: I have a program that allows a user to deposit and withdraw money while updating their balance based on the month the transaction occured, but I am having trouble with the programs class and am trying to make a bar chart that will have the total balance of that month, so as an example in May the bar would show $70, while the bar for June would show $100, even if the deposits were $20 and $50, then $30, $40 and $30.arrow_forwardWrite an application that counts by five from 5 through 500 inclusive and that starts a new line after every multiple of 50 (50,100,150 and so on).Save the file as CountByAnything.javaarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT