1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculating the island of Manhattan gains after 400 years.

  1. Jun 20, 2011 #1
    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.



    2. Relevant equations

    simple Interest = Principal amount * Interest rate * years



    3. 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;
    }
     
  2. jcsd
  3. Jun 21, 2011 #2

    MATLABdude

    User Avatar
    Science Advisor

    The basic algorithm looks all right (I'd clean up the output format a little, but that's just me). However, is there a reason you're incrementing totMoney (totMoney++)? Does the legend include a $1 payment every 50 years?

    I'd also suggest using an int for year--you won't have any decimal artifacts in the year field.

    EDIT: And now compare it with compound interest--by 2026, that $24 would have turned into $7,176,800,429.97.
     
    Last edited: Jun 21, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Calculating the island of Manhattan gains after 400 years.
Loading...