Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Programming Assignment #6 Monitor a Population CS 1428.302, Spring 2018 Instructor: Jill Seaman Due: in class Thursday, 4/5/2018 (upload electronic copy by 9:00am) Problem: Your
Programming Assignment #6 Monitor a Population CS 1428.302, Spring 2018 Instructor: Jill Seaman Due: in class Thursday, 4/5/2018 (upload electronic copy by 9:00am) Problem: Your friend the biology lab assistant has a new job and now needs to monitor different populations of rabbits used in his lab. He needs to be able to predict the size of the population based on the initial population size and the average birth and death rates of the rabbits. Write a program that asks the user for an initial population size, the birth rate and death rate, and the number of years to monitor the population. Then calculate and output a table of changes in population size over those years. The formula to compute the new population size is: where N is the new population size, P is the previous population size, B is the birth rate, and D is the death rate. The birth and death rates are values between 0 and 1 Your program should output a table showing the starting population and the new population at the end of each year that the population is being monitored. To output the table, you will calculate the first year population using the initial population size for P, then calculate the second year using the first year population for P and so on, until you have calculated all of the requested years. Finally, if the growth rate (the birth rate - death rate) is positive your program will notify the user in which year the population will double in size. The formula to calculate this is: n log(2)/ log(1 r) where log is a function in the cmath library, and r is the growth rate. If the growth rate is negative, you should notify the user in which year the population will become 0. The formula to calculate this is: nlog(1/P) log(1 +r)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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