Assigned Question Reads : An input file contains data on animals being monitored
ID: 3610687 • Letter: A
Question
Assigned Question Reads:An input file contains data on animals being monitored in anational park. The very first line has an integer representing thenumber of years (n) for the study. For each animal, the first inputline has the animal's name, and the second line has three values:the park's population (P) of that animal on the first day of theyear; the annual birth rate (B) of that animal; the annual deathrate (D) of that animal.
The program is to calculate, for each animal, the estimatedpopulation after n years. The program should not process bad data,such as a negative birth rate, a negative death rate, or apopulation less than 2. The program must use the followingfunctions:
1. GrowthRate: This function takes as itsparameter the birth and death rates, and it returns the populationgrowth rate.
2. EstimatedPopulation: This function takes as itsparameters the current population, population growth rate, and n,the number of years. It returns the estimated population after nyears.
Formulas
If P is the population on the first day of the year, B is the birthrate, and D is the death rate, the estimated population at the endof the year is given by:
P + B*P/100 - D*P/100
The population growth rate is given by the formula: B-D
Output to a file, telling the number of years ofthe study, then the names and estimated populations of each animalat the end of the study.
Sample input file could contain:
5
Fox
300 28 15
Rabbit
525 50 40
Bald Eagle
20 -5 12
Lynx
1 20 10