You put $1000 in the bank at 5% annual simple interest. How much will you have at the end of one year?

A good answer might be:

With simple interest you will have $1000 + $1000*0.05 = $1050.

Million Dollar Question

Usually banks use compound interest, but for simplicity let us stick with simple interest. At the end of the second year you will have $1050 + $1050*0.05 = $1102.50. Here is what your account looks like at the end of the first several years:

  1. $1050
  2. $1102.50
  3. $1157.625
  4. $1215.50625
  5. $1276.28156
  6. . . .

Let us say that you are interested in becoming a millionaire. How long will you need to keep your money in the bank for it to reach one million dollars? There are financial formulas for this (most spreadsheets have these formulas built in, as do financial hand calculators.) But pretend that you don't know that. Here is the outline of a program to calculate how many years it will take:

class millionDollarYears
{

  public static void main( String[] args )
  {
    double dollars = 1000.00 ;
    int    year = _______________;     

    while ( dollars < 1000000.00 )
    {
      // add another year's interest

      dollars = _______________;

      year    = _______________;
    }

    System.out.println("It took " + year + " years to reach your goal.");
  }

}

The value of the bank account, dollars keeps building up until the goal has been reached or exceeded.

QUESTION 2:

Fill in the blanks to complete the program.

Click Here after you have answered the question