39.9k views
4 votes
5.11: Population Write a program that will predict the size of a population of organisms. The program should ask the user for the starting number of organisms, their average daily population increase (as a percentage, expressed as a fraction in decimal form: for example 0.052 would mean a 5.2% increase each day), and the number of days they will multiply. A loop should display the size of the population for each day.

User JMoura
by
6.7k points

1 Answer

0 votes

Final answer:

To predict the size of a population of organisms, write a program that takes the starting number, average daily increase, and number of days. Use a loop to calculate and display the size for each day.

Step-by-step explanation:

To predict the size of a population of organisms, you can write a program that takes the starting number of organisms, the average daily population increase (as a percentage), and the number of days they will multiply. You can use a loop to calculate and display the size of the population for each day.

Here's a step-by-step explanation of how you can implement this program:

  1. Ask the user for the starting number of organisms.
  2. Ask the user for the average daily population increase as a fraction in decimal form.
  3. Ask the user for the number of days the organisms will multiply.
  4. Initialize a variable to store the current population size and set it to the starting number of organisms.
  5. Use a loop to iterate through each day.
  6. Inside the loop, calculate the population increase by multiplying the current population size by the average daily population increase.
  7. Add the population increase to the current population size.
  8. Display the current population size for each day.

User Xiaodong
by
6.7k points