A long time.
Here is the start on a program that calculates how long it will take:
class MillionDollarYears { public static void main( String[] args ) { double dollars = 1000.00 ; final double interest = 0.05; int year = ; while ( dollars < 1000000.00 ) // A result-terminated loop { // 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.
dollars
Fill in the blanks to complete the program.