subject

Transient population in c++populations are effected by the birth and death rate, as well as the number of people who move in and out each year. the birth rate 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 p-the annual birth rate (as a percentage of the population expressed as a fraction in decimal form) b-the annual death rate (as a percentage of the population expressed as a fraction in decimal form) d-the average annual number of people who have arrived a-the average annual number of people who have moved away m-the number of years to display nyearswrite a function that calculates the size of the population after a year. to calculate the new population after one year, this function should use the formula n = p + bp - dp + a - m where n is the new population size, p is the previous population size, and b, d, a and m are as defined above. the function should return the value computed for n and should receive the values of p, b, d, a and m as parameters. prompts and output labels. the program first displays the message "this program calculates population change." on a line by itself, followed by these prompts for the inputs described above: "enter the starting population size: " "enter the annual birth rate (as % of current population): " "enter the annual death rate (as % of current population): " "how many individuals move into the area each year? "; "how many individuals leave the area each year? "; "for how many years do you wish to view population changes? "the output of the program starts with a line: starting population: p (where p is the starting population ( and then continues with a separate line for each year, each line being of the form: population at the end of year ||y is p. (where y is the year number (1,2, starting with 1, and where p is the population calculated for that year).input validation. the program should validate all data read. none of the data should be negative, the number of years should not be less than 1 and the initial population should not be less than 2. if an invalid value is read, the program should print an error-specific message on a line by itself, followed by the directive " re-enter: " and then input another value-- until a valid value is entered. the error specific messages are: "starting population must be 2 or more.", "birth rate percent cannot be negative.", "death rate percent cannot be negative.", "arrivals cannot be negative.", "departures cannot be negative.", and "years must be one or more.".expected output: this·program·calculates·population· change.↵enter·the·starting·populati on·size: ·enter·the·annual·birth·rate·(as·%· of·current·population): ·enter·the·annual·death·rate·(as·%· of·current·population): ·how·many·individuals·move·into·the ·area·each·year? ·how·many·individuals·leave·the·are a·each·year? ·for·how·many·years·do·you·wish·to· view·population·changes? ·↵↵starting·population: ·100↵↵population·at·the·end·of·year ·1·is·103.↵population·at·the·end·of ·year·2·is·107.↵population·at·the·e nd·of·year·3·is·111.↵population·at· the·end·of·year·4·is·114.↵populatio n·at·the·end·of·year·5·is·118.↵popu lation·at·the·end·of·year·6·is·122. ↵population·at·the·end·of·year·7·is ·125.↵population·at·the·end·of·year ·8·is·129.↵population·at·the·end·of ·year·9·is·132.↵population·at·the·e nd·of·year·10·is·136.↵

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:00, 420420blazee
Are special characters that allow you to search for multiple words at the same time.
Answers: 2
image
Computers and Technology, 23.06.2019 06:00, tchloe448
What makes myhexadecimalnumber a child of mynumber? which methods does myhexadecimalnumber inherit directly from the mynumber class? what can an instance of the mynumber class do? what can an instance of the myhexadecimalnumber class do? which methods are overridden? why are they overridden? how many examples of overloading are there? why was this done? where is the super keyword used? what is it doing? why isn’t the incoming value set immediately in the second myhexadecimalnumber constructor? how many examples can you find of an inherited method being called?
Answers: 1
image
Computers and Technology, 23.06.2019 21:40, minnie7760
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
Answers: 2
image
Computers and Technology, 24.06.2019 07:00, jordaaan101
Guys do you know sh27 cause he hacked me : ( pidgegunderson my old user
Answers: 2
You know the right answer?
Transient population in c++populations are effected by the birth and death rate, as well as the numb...

Questions in other subjects:

Konu
Social Studies, 12.09.2019 05:30