View the step-by-step solution to:

# #include &lt;iostream&gt; #include &lt;iomanip&gt; using namespace std; double population(double pop, double birthRate, double deathRate); void

#include <iostream>
#include <iomanip>
using namespace std;
double population(double pop, double birthRate, double deathRate);
void Populations(double startPop, double birthRate, double deathRate, int numYears);
double population(double pop, double birthRate, double deathRate)
{
double n = 0;
n = pop + (birthRate*pop) - (deathRate*pop);
return n;
}
void Populations(double startPop, double birthRate, double deathRate, int numYears)
{
for ( int i = 0 ; i < numYears ; i++ )
{
startPop = population (startPop, birthRate, deathRate, numYears, double n);
cout << "For year " << i+1 << " the population is " << startPop << endl ;
}
}
int main()
{
double startPop, birthRate, deathRate; int numYears;
cout << "Enter the starting population size: ";
cin >> startPop;
while (startPop < 2.0)
{
cout << "Starting population must be 2 or more. Please re-enter: ";
cin >> startPop;
}
cout << "Enter the annual birth rate : ";
cin >> birthRate;
while (birthRate < 0)
{
cout << "Birth rate percent cannot be negative. Please re-enter: ";
cin >> birthRate;
}
birthRate = birthRate / 100;
cout << "Enter the annual death rate : ";
cin >> deathRate;
while (deathRate < 0)
{
cout << "Death rate percent cannot be negative. Please re-enter: ";
cin >> deathRate;
}
deathRate = deathRate / 100;
cout << "For how many years do you wish to view population changes? ";
cin >> numYears;
while (numYears < 1)
{
cout << "Years must be one or more. Please re-enter: ";
cin >> numYears;
return 0;
}

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents