Answer:
// using c++ language
#include "stdafx.h";
#include <iostream>
#include<cmath>
using namespace std;
//start
int main()
{
//Declaration of variables in the program
double start_organisms;
double daily_increase;
int days;
double updated_organisms;
//The user enters the number of organisms as desired
cout << "Enter the starting number of organisms: ";
cin >> start_organisms;
//Validating input data
while (start_organisms < 2)
{
cout << "The starting number of organisms must be at least 2.\n";
cout << "Enter the starting number of organisms: ";
cin >> start_organisms;
}
//The user enters daily input, here's where we apply the 5.2% given in question
cout << "Enter the daily population increase: ";
cin>> daily_increase;
//Validating the increase
while (daily_increase < 0)
{
cout << "The average daily population increase must be a positive value.\n ";
cout << "Enter the daily population increase: ";
cin >> daily_increase;
}
//The user enters number of days
cout << "Enter the number of days: ";
cin >> days;
//Validating the number of days
while (days<1)
{
cout << "The number of days must be at least 1.\n";
cout << "Enter the number of days: ";
cin >> days;
}
//Final calculation and display of results based on formulas
for (int i = 0; i < days; i++)
{
updated_organisms = start_organisms + (daily_increase*start_organisms);
cout << "On day " << i + 1 << " the population size was " << round(updated_organisms)<<"."<<"\n";
start_organisms = updated_organisms;
}
system("pause");
return 0;
//end
}
Explanation: