I need help figuring out what is wrong with my code. I've included my code - the output it displays and what it is suppose to display.

MY CODE:

Code:

#include <iostream>
#include <iomanip>
using namespace std;
double populationSize(double P, double B, double D, double A, double M);
int main() {
double populationStart;
double annualB;
double annualD;
double peopleA;
double peopleM;
double result;
int nYears;
cout<<"This program calculates population change.\n";
cout<<"Enter the starting population size: ";
cin>>populationStart;
if(populationStart < 2) {
cout<<"\nStarting population must be 2 or more.";
cout<<"\nPlease re-enter:";
cin>>populationStart;
}
cout<<"Enter the annual birth rate (as % of current population):";
cin>>annualB;
if(annualB < 0) {
cout<<"\nBirth rate percent cannot be negative.";
cout<<"\nPlease re-enter:";
cin>>annualB;
}
cout<<" Enter the annual death rate (as % of current population):";
cin>>annualD;
if(annualD < 0) {
cout<<"\nDeath rate percent cannot be negative.";
cout<<"\nPlease re-enter:";
cin>>annualD;
}
cout<<" How many individuals move into the area each year? ";
cin>>peopleA;
if(peopleA < 0) {
cout<<"\nArrivals cannot be negative.";
cout<<"\nPlease re-enter:";
cin>>peopleA;
}
cout<<"How many individuals leave the area each year? ";
cin>>peopleM;
if(peopleM < 0) {
cout<<"\nDepartures cannot be negative.";
cout<<"\nPlease re-enter:";
cin>>peopleM;
}
cout<<"For how many years do you wish to view population changes? \n";
cin>>nYears;
if(nYears < 1) {
cout<<"\nYears must be one or more.";
cout<<"\nPlease re-enter:";
cin>>nYears;
}
cout<<"\nStarting population: "<<populationStart<<"\n";
result = populationStart;
for(int y = 1; y < nYears; y++) {
result = populationSize(result, annualB, annualD, peopleA, peopleM);
cout<<"\n";
cout<< showpoint << setprecision(3) << "Population at the end of year "<<y<<" is "<<result;
}
return 0;
}
double populationSize(double P, double B, double D, double A, double M) {
double n;
n = P + (B/100 * P) - (D/100 * P) + A - M;
return n;
}

EXPECTED OUTPUT:

This program calculates population change.

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?

Starting population: 100

Population at the end of year 1 is 103.

Population at the end of year 2 is 107.

Population at the end of year 3 is 111.

Population at the end of year 4 is 114.

Population at the end of year 5 is 118.

Population 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 end of year 10 is 136.

ACTUAL OUTPUT:

This program calculates population change.

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?

Starting population: 100

Population at the end of year 1 is 104.

Population at the end of year 2 is 107.

Population at the end of year 3 is 111.

Population at the end of year 4 is 115.

Population at the end of year 5 is 118.

Population at the end of year 6 is 122.

Population at the end of year 7 is 126.

Population at the end of year 8 is 129.

Population at the end of year 9 is 133.