Answer:
The previous program used a loop that iterated 40 times to calculate that.
Pasting in the Dollars Calculation
Here is the part from the previous program (slightly modified) that calculates the number of dollars after 40 years:
year = 1 ;
dollars = initialAmount; // initialize the loop correctly
while ( year <= 40 )
{
dollars = dollars + dollars*rate ; // add another year's interest
dollars = dollars + 1000 ; // add in this year's contribution
year = year + 1 ;
}
Here is the skeleton program again:
To complete the program you will have to nest one loop inside the other.
QUESTION 10:
Copy and paste sections of code.