A good answer might be:

dollars = dollars + 1000 ;

Slighly Less Gloomy

Here is the completed program:

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

    while ( dollars < 1000000.00 )
    {
      // add another year's interest
      dollars =  dollars + dollars*0.05 ; 

      // add in this year's contribution
      dollars = dollars + 1000 ;

      year    =  year + 1 ;
    }

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

}

And here is its output:

C:\Notes\chap19>java  MillionDollarYears
It took 80 years to reach your goal.

QUESTION 5:

Now it only takes 80 years to reach one million dollars. This is a considerable improvement. Can you wait that long?