## CS 1401 Introduction to Computer Science Fall 2014, Lab 5

Assignment. This is similar to Lab 4, but now, instead of predicting how your deposit will increase in one year, you need to predict how it will increase in a given number of years. Write a program that prompts the user to input:
• the threshold,
• the smaller interest rate (in percents),
• the larger interest rate (in percents),
• the user's name,
• the amount the user wants to deposit, and
• the number of years that the user wants to trace.
Your program should find out, for each of these years:
• what is the effective interest rate for the amount the user deposited,
• how big is the increase, and
• what is the resulting amount of money at the end of this year.

Example. Suppose that the threshold is \$1,000, the smaller interest rate is 0.9%, the larger interest rate is 1.5%, you invest \$990, and you want to trace this amount for 3 years.

In the first year, the amount is smaller than the threshold, so your effective interest rate is 0.9%. This means that at the end of Year 1, you earn an additional amount of \$990 * (0.9 / 100) = \$8.91. Thus, at the end of Year 1, your deposit will be equal to \$990 + \$8.91 = \$998.91.

The resulting amount is still smaller than the threshold, so in Year 2, your effective interest rate is still 0.9%. This means that at the end of Year 2, you earn an additional amount of \$998.91 * (0.9 / 100) = \$8.99. Thus, at the end of Year 2, your deposit will be equal to \$998.91 + \$8.99 = \$1,007.90.

This amount is already larger than the threshold, so your effective interest rate is 1.5%. This means that at the end of Year 3, you earn an additional amount of \$1,007.90 * (1.5 / 100) = \$15.12. Thus, at the end of Year 1, your deposit will be equal to \$1,007.90 + \$15.12 = \$1,023.02.

You should present the results of the computations in a nice and clear form, e.g., as follows:

```Report on John Johnson's saving account:
Original amount              990.00

Year 1:
effective interest rate        0.9%
amount gained                  8.91
amount at the end of Year    998.91

Year 2:
effective interest rate        0.9%
amount gained                  8.99
amount at the end of Year   1007.90

Year 3:
effective interest rate        1.5%
amount gained                 15.12
amount at the end of Year   1023.02

Thanks for using our bank!
```
When it is due. The program is due at the beginning of the first lab section on the week of October 6, i.e.:
• on Monday October 6 for those who attend Monday-Wednesday labs, and
• on Tuesday October 7 for those who attend Tuesday-Thursday labs.