Question

In: Computer Science

A local biologist needs a program to predict population growth. The inputs would be: The initial...

A local biologist needs a program to predict population growth. The inputs would be:

  1. The initial number of organisms, as an int
  2. The rate of growth (a real number greater than 1), as a float
  3. The number of hours it takes to achieve this rate, as an int
  4. A number of hours during which the population grows, as an int

For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate of 6 hours. Assuming that none of the organisms die, this would imply that this population would double in size every 6 hours. Thus, after allowing 6 hours for growth, we would have 1000 organisms, and after 12 hours, we would have 2000 organisms.

Write a program that takes these inputs and displays a prediction of the total population.

An example of the program input and output is shown below:

Enter the initial number of organisms: 10
Enter the rate of growth [a real number > 1]: 2
Enter the number of hours to achieve the rate of growth: 2
Enter the total hours of growth: 6

The total population is 80

Solutions

Expert Solution

SOLUTION

The following python program has been used to calculate or predict the population growth of organisms based on a given growth rate over a period of time.

PROGRAM

# Predict Organic Population Growth

# Get the input values
organisms = int(input('Enter the initial number of organisms: '))
growthRate = int(input('Enter the rate of growth [a real number > 1]: '))
numHours = int(input('Enter the number of hours to achieve the rate of growth: '))
totalHours = int(input('Enter the total hours of growth: '))

hours = 0
# Until hours equal total hours, iteratively calculate organism growth based on growth rate (numHours)
while hours <= totalHours:
    organisms = organisms * growthRate
    hours = hours + numHours

    if hours == totalHours:
        break

print('The total population is: ', organisms)

OUTPUT

Note:

Based on the growth rate the organism growth is calculated. The process is repeated until the hours reach the total period of hours given for the growth.

Hope this helps.


Related Solutions

language: python A local biologist needs a program to predict population growth. The inputs would be:...
language: python A local biologist needs a program to predict population growth. The inputs would be: The initial number of organisms, as an int The rate of growth (a real number greater than 1), as a float The number of hours it takes to achieve this rate, as an int A number of hours during which the population grows, as an int For example, one might start with a population of 500 organisms, a growth rate of 2, and a...
4.9: Population Write a program that will predict the size of a population of organisms. The...
4.9: 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. Prompts, Output Labels and Messages.The three input data...
A population of fish in a lake follow a logistic growth model. With an initial growth...
A population of fish in a lake follow a logistic growth model. With an initial growth rate of 10%, an initial population of 50, and a carrying capacity of 500, how many fish will be in the pond after 5 years? Solve and graph the solution to this equation. Explain why this differential equation does or does not serve as a realistic model.
Write a C++ program that inputs the world's population at the end of last year. Assume...
Write a C++ program that inputs the world's population at the end of last year. Assume population is growing at a rate of 1.12%. Output the year (starting with this year) and the population until the population is greater than 10billion. Test data: 6.83 billion. (leave like this rather than 6800000000). Name as a comment and printed to output. Output as a comment at the bottom of the code
State 3 assumptions made in stage-structured population growth models and explain why a conservation biologist who...
State 3 assumptions made in stage-structured population growth models and explain why a conservation biologist who is in charge of managing an endangered plant population needs to be aware of each assumption before applying model outcomes to management plants.
Program Specifications: PART ONE: The client would like a program that inputs a user's first and...
Program Specifications: PART ONE: The client would like a program that inputs a user's first and last name. The program will also input the user's height and weight. The program will output the following for the input data. (assuming the input was Dennis, Hunchuck, 6.0, 220.0) You can assume that the user runs 1 mile per day. The user loses 1/2 pound for each day he or she runs. You can ask the user how many days he or she...
"4. (Modify) Modify Program 7.14 so that the user inputs the initial set of numbers when...
"4. (Modify) Modify Program 7.14 so that the user inputs the initial set of numbers when the program runs. Have the program request the number of initial numbers to be entered." //C++ Program 7.14 as follows #include #include #include #include using namespace std; int main() { const int NUMELS = 4; int n[] = {136, 122, 109, 146}; int i; vector partnums(n, n + NUMELS); cout << "\nThe vector initially has the size of " << int(partnums.size()) << ",\n and...
A statistical program is recommended. The owner of a movie theater company would like to predict...
A statistical program is recommended. The owner of a movie theater company would like to predict weekly gross revenue as a function of advertising expenditures. Historical data for a sample of eight weeks follow. Weekly Gross Revenue ($1,000s) Television Advertising ($1,000s) Newspaper Advertising ($1,000s) 96 5 1.5 91 2 2 95 4 1.5 93 2.5 2.5 95 3 3.2 94 3.5 2.2 94 2.5 4.1 94 3 2.5 (a) Use α = 0.01 to test the hypotheses H0: β1 =...
A statistical program is recommended. The owner of a movie theater company would like to predict...
A statistical program is recommended. The owner of a movie theater company would like to predict weekly gross revenue as a function of advertising expenditures. Historical data for a sample of eight weeks follow. Weekly Gross Revenue ($1,000s) Television Advertising ($1,000s) Newspaper Advertising ($1,000s) 96 5 1.5 91 2 2 95 4 1.5 93 2.5 2.5 95 3 3.2 94 3.5 2.3 94 2.5 4.2 94 3 2.5 (a) Use α = 0.01 to test the hypotheses H0: β1 =...
Inputs discount rate 22.50% revenue growth rate 2.50% Initial investment $800,000.00 revenue (year 1) $190,000.00 (a)...
Inputs discount rate 22.50% revenue growth rate 2.50% Initial investment $800,000.00 revenue (year 1) $190,000.00 (a) complete table below (8 pts) Cash flows year 0 year 1 year 2 year 3 year 4 year 5 year 6 (b) Calculate NPV and IRR (8 pts) NPV IRR (c) Would you accept in this project? Explain your answer (3 pts) (d) what is the minimum revenue growth rate that would be consistent with accepting this project? (7 pts) Answer: (e) Explain how...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT