Population

I have to write a program based on population.

In a population, the birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of hte population due to deaths. Write a program that asks for the following:
- the starting size of the population
- the annual birth rate
- the annual death rate
- the number of years to display

The program should then display the starting population and the projected population at the end of each year. It should use a function that calculates and returns the projected new size of the population after a year. The formula is N = P(1+B)(1-D)
where N is hte new population size, P is the previous population size, B is th ebirth rate, and D is th edeath rate.

I also cannot accept numbers less than 2 for the starting size. And I cannot accept negative numbers for birth rate or death rate. Also I annot accept numbers less than 1 for the number of years.


I know how to do some things for this program, such as setting limits for hte different integers...but I do not know how to start it. I am not good at setting up functions...any help at how to get it started would be appreciated.
Last edited on
First write a function that takes P, B and D and calculates the formula you're given. Then write another function that takes P, B, D and the number of years Y. This function should have a for loop that goes Y times. Each cycle will call the first function and then print its result. Don't forget to update P.

The rest of the program is just to get input and call the second function.
Topic archived. No new replies allowed.