Write a program that will predict the size of a population of organisms. The pro
ID: 3527277 • Letter: W
Question
Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase (as a percentage), and the number of days they will multiply. For example, a population might begin with two organisms, have an average daily increase of 50%, and will be allowed to multiply for seven days. The program should use a loop to display the size of the population for each day. Note: Input Validation: Do not accept a number less than two for the starting size of the population. Do not accept a negative number for the average daily population increase. Do not accept a number less than one for the number of days they will multiply.Explanation / Answer
PLEASE RATE ME AND AWARD ME KARMA POINTS IF IT IS HELPFUL FOR YOU /** This program demonstrates a user controlled loop */ public class Population public static void main(String[] args) { int Size, Days, increase, number, Temp; String input; // To Hold the user's input //Create a Scanner object for keyboard input. Scanner Keyboard = new scanner(System.in); int startingSize = 0, dailyIncrease = 0, numberOfDays = 0; int temp = 0; //accept initial user input here while (startingSize < 2) { System.out.print("Please enter a number that is greater than 1 for the population size: "); startingSize = keyboardInput.nextInt(System.in); } while (dailyIncrease < 0) { System.out.print("Enter a positive integer for the population size increase: "); dailyIncrease = keyboardInput.nextInt(System.in); } //do the same while loop for numberOfDays as a positive number > 0 temp = startingSize; dailyIncrease = dailyIncrease + 1; for(int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.