It is not a sentinel controlled loop because there is no data being read in that contains a sentinel.
How many years does it take to reach a million dollars? 142
It might be that you do not wish to wait that long. After examining your lifestyle, you decide to give up your expensive chocolate-chip cookie habit and now can put an extra $1000 into your bank account at the end of every year. Now how long will it take to reach your million dollar goal?
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
;
year = year + 1 ;
}
System.out.println("It took " + year + " years to reach your goal.");
}
}
Fill in the bank.... err, blank.