this is the code i have for my program. i'm having trouble keeping the output in integer format since i'm multiplying by floating point numbers. i'm also having a problem with the last output, mine keeps coming up as 281. if someone could help me out that'd be great.

our output should look like this:

How many jackalopes do you have? 200

How many generations do you want to wait? 1

If you start with 200 jackalopes and wait 1 generations,

you'll end up with a total of 204 of them.

How many jackalopes do you have? 132

How many generations do you want to wait? 2

If you start with 132 jackalopes and wait 2 generations,

you'll end up with a total of 137 of them.

How many jackalopes do you have? 40

How many generations do you want to wait? 100

If you start with 40 jackalopes and wait 100 generations,

you'll end up with a total of 291 of them.

Code:

// This program calculates population growth using a loop.

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

int jacks, // initial number of jackalopes

gens; // number of generations

const float birthRate = .03, // birth rate

deathRate = .01; // death rate

// Ask user initial jackalope population.

cout << "How many jackalopes do you have? \n";

cin >> jacks;

// Ask user how many generations will be calculated.

cout << "How many generations do you want to wait? \n";

cin >> gens;

int newPop, // population of jackalopes including births

newPop2; // population of jackalopes including deaths

newPop = jacks;

cout << showpoint << fixed << setprecision(2);

for (int i = 1; i <= gens; i++)

{

newPop = (newPop * birthRate) + newPop; // calculate new population of jackalopes

newPop2 = newPop - (newPop * deathRate); // calculate how many jackalopes die

newPop = newPop2; // total population

}

cout << "If you start with "<< jacks <<" jackalopes and wait "<< gens <<" generation(s), \n";

cout << "you'll end up with a total of "<< newPop2 <<" of them. \n";

return 0;

}