Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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, and the number of days they will multiply. For example, a population might begin with two organisms, have a daily average increase of 50 percent, 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.
Input Validation: Do not accept a number less than 2 for the starting size of the population. Do not accept a negative number for average daily population increase. Do not accept a number less than 1 for the number of days they will multiply.
You should get something like the following when you run this program:
User Prompts: (User input in bold)
Enter the starting number of organisms: 2
Enter the daily increase: .50
Enter the number of days the organisms will multiply: 7
Program Output:
Day Organisms
1 2.0
2 3.0
3 4.5
4 6.75
5 10.125
6 15.1875
7 22.78125
Modify the program you just wrote so it writes the output to a file instead of the computer screen. The number of organisms in this version of the program should be a real number rounded to two significant figures after the decimal point. Open your output text file with Notepad or another text editor to confirm the output.

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

4.5 Explain what competencies and competency modeling are.

Answered: 1 week ago

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago