Question
C++ Write a program that approximates the population growth of a species assuming the exponential growth model Pt = (1 + r E) Pt1, (1)
C++
Write a program that approximates the population growth of a species assuming the exponential growth model
Pt = (1 + r E) Pt1, (1)
where Pt represents this years population, Pt1 represents last years population,
r = (birth rate death rate) (2)
is the growth rate constant, and E is an additional effect on the species due to environmental causes that has some inherent randomness and changes from year to year. This additional effect can be interpreted as adding or subtracting individuals from a population. When E = 0, we say the model is deterministic and
P(t) = P0(1 + r)^ t , (3)
where P0 represents the initial population and P(t) is the number of individuals in the population after t years. Note that for the determinist growth model in equation (3), we can compute the population at any year t = T by simply knowing P0 and r. For the model that includes environmental influences in equation (1), we need to compute all the years from t = 0 to t = (T 1) before we can compute PT .
Start your program by prompting the user to enter the initial population P0, the birth rate, the death rate, and the amount of years T you are interested in studying the given population. Then, assuming the same trend will continue, write a function growth rate that returns the growth rate constant r and a function population that estimates the population, choosing the right model depending on the value of E. 1 Using the deterministic model in equation (3), make your program find the estimate population P(T) after T years. Implement the function extinction to determine if extinction is possible under given conditions. Using the environmental model from equation (1), call the population function to output one estimate of PT by computing the random environmental rate E for each year. Implement another function extinction probability to compute the probability that the species will become extinct during T years under the random environmental model. You can do this by computing the population PT under the environmental model 100 times and counting how many times the population becomes extinct. Your program should not allow an initial population less than 2, negative population, or fractional population. Keep the random effect restricted such that 1 E 1. The final output should be a table comparing the population growth for the deterministic model and the environmental model, and the possibility of extinction in both cases.
Sample Output:
Initial Population = 1900
Birth Rate = 0.3
Death Rate = 0.35
Years = 15
MODEL YEARS POPULATION EXTINCTION
DETERMINISTIC 15 880 POSSIBLE
ENVIRONMENTAL 15 15 PROB = 0.6
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started