Question
An input file contains data on animals being monitored in anational park.The very first lines 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 lines 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. Thje program should not process bad dats,such as negative birth rate; a negative death rate, or a populationlessthan 2. The program must use the following functions: (1) GrowthRate: This function takes as itsparameters the birth and death rates, ans it returns the popultiongrowth. (2) estimatedPoipulation:This function takes as its parameters the current population,population growth rate, and n, the number of years. It returns theestimated population after n years. An input file contains data on animals being monitored in anational park.The very first lines 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 lines 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. Thje program should not process bad dats,such as negative birth rate; a negative death rate, or a populationlessthan 2. The program must use the following functions: (1) GrowthRate: This function takes as itsparameters the birth and death rates, ans it returns the popultiongrowth. (2) estimatedPoipulation:This function takes as its parameters the current population,population growth rate, and n, the number of years. It returns theestimated population after n years.
Explanation / Answer
please rate - thanks #include #include #include using namespace std; double GrowthRate(int,int); double EstimatedPopulation(int,int,int); int main() {int n; int P,B,D; double growth,estpop; string data; ifstream input; ofstream output; input.open("input.txt"); //open file if(input.fail()) //is it ok? { cout