- #1
lcam2
- 28
- 0
According to the legend, the island of Manhattan was purcased from the native indian population in 1626 for 24 dollars. Assuming this money was invested in a Dutch bank paying 5 %
simple interest per year, costruct a table in C++ showing how much money the native population would have at the end of each 50- year period, starting in 1626 and ending 400 years latter.
I'm having problems when i try to calculate the total amount of money every 50 year period.
Thanks in advance.
simple Interest = Principal amount * Interest rate * years
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main ()
{
float year;
double rate, interest, totMoney;
year = 1626;
rate = .05;
cout << " Year Interest gained Total Money" << endl;
cout << "-----------------------------------------------"<< endl;
cout << endl;
while( year <= 2026)
{
interest = 24 * .05* 50;
totMoney = 24 + interest;
cout << setw(7) << year << setw(15) << interest << setw(15)<< totMoney << endl;
cout << endl;
totMoney ++;
year += 50;
}
return 0;
}
simple interest per year, costruct a table in C++ showing how much money the native population would have at the end of each 50- year period, starting in 1626 and ending 400 years latter.
I'm having problems when i try to calculate the total amount of money every 50 year period.
Thanks in advance.
Homework Equations
simple Interest = Principal amount * Interest rate * years
The Attempt at a Solution
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main ()
{
float year;
double rate, interest, totMoney;
year = 1626;
rate = .05;
cout << " Year Interest gained Total Money" << endl;
cout << "-----------------------------------------------"<< endl;
cout << endl;
while( year <= 2026)
{
interest = 24 * .05* 50;
totMoney = 24 + interest;
cout << setw(7) << year << setw(15) << interest << setw(15)<< totMoney << endl;
cout << endl;
totMoney ++;
year += 50;
}
return 0;
}