Question: Please write an algorithm and then write a c++ program that includes a function In a population, the birthrate is the percentage increase of the
In a population, the birthrate is the percentage increase of the population due to births, and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population (must be positive integer greater than 2) The annual birthrate (must be positive) The annual death rate (must be positive) The number of years to display (must be positive integer) . Write an algorithm and then write a C+ program that includes a function. The function calculates the size of the population for a year. The formula is N-P+BP-DP where N is the new population size, P is the previous population size, B is the birthrate, and D is the death rate. Sample Outputs his program calculates population change. Enter the starting population size: 250000 Enter the annual birth rate (as % of current population): 2 Enter the annual death rate (as % of current population): 1.5 or how many years do you wish to view population changes? 5 Starting population: 250000 Population at the end of year 1 is 251250o Population at the end of year 2 is 252506 Population at the end of year 3 is 253768 Population at the end of year 5 is 256312 rocess returned o Press any key to continue. C0x0) execution time : 29.294 s
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
