Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

17. Population Write a program that will predict the size of a population of organisms. The program should ask the user for the starting number

17. 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 of current population), and the number of days they will multiply. A loop should display the size of the population for each day. Print out population numbers to 2-3 places after the decimal point

Include the following data validation loops:

  • Starting number of organisms (double):

    • must be > = 2 (do not check for non-numeric. Test only with numbers)

  • daily population increase (double)

    • must be > 0 (do not check for non-numeric. Test only with numbers)

  • number of days (integer)

    • must be >= 1 (do not check for non-numeric. Test only with numbers)

The program requires you to code loops.

  • Use loops for the data validation. You may use do-while or while loops. Click here for data validation code.

  • Complete the "for" loop structure to print out 1 line for each day

  • For each day, print out the population at the start and end of each day.

results should look like this

Enter starting population: -100

Invalid. Population must be 2 or greater.

Enter starting population: 1

Invalid. Population must be 2 or greater.

Enter starting population: 100

Enter daily growth % (.1 must be entered as 10): 10.5

Enter number of days to calculate: 10

-----------------------------------------------------------

Start Population: 100.00

Daily Percent Growth: 10.50%

Number of Days: 10

Day Population Population

at day start at day end

------------------------------------------------------

1 100.00 110.50

2 110.50 122.10

3 122.10 134.92

4 134.92 149.09

5 149.09 164.74

6 164.74 182.04

7 182.04 201.16

8 201.16 222.28

9 222.28 245.62

10 245.62 271.41

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

8. Describe characteristics and advantages of mediation.

Answered: 1 week ago

Question

Commen Name with scientific name Tiger - Wolf- Lion- Cat- Dog-

Answered: 1 week ago

Question

7. It is advisable to do favors for people whenever possible.

Answered: 1 week ago