Borrowing money for expensive items has become a way of life for most Americans. To illustrate the high cost of borrowing and how such loans work, you will be writing a class to calculate the following monthly analysis of a loan.
Month
Principal Loan Amt.
Interest
(at 1%/month)
Payment
New Balance
1
10000.00
100.00
300.00
9800.00
2
9800.00
98.00
300.00
9598.00
3
9598.00
95.98
300.00
9393.98
4
9393.98
93.94
300.00
9187.92
and many months later ...
39
809.46
8.09
300.00
517.55
40
517.55
5.18
300.00
222.73
Total:
2222.73
The loan analysis above started with the following information:
The monthly interest rate is found by dividing the annual rate among 12 months. For the above example the monthly rate is 1.0 %. The last three values of each line are calculated as follows:
Interest = Principal * Monthly Interest Rate
Payment = amount set at beginning of problem
New Balance = Principal + Interest - Payment
The new balance becomes the starting principal amount for the next month. As you can see, progress toward decreasing the principal is slow at the beginning of the loan.
Assignment:
Write a class to represent a loan as described above using the five-column format. Your class must accomplish the following:
Data input: The class should ask for the appropriate starting information.
Printing of analysis: The class must print the month-by-month analysis until the remaining principal is less than the monthly payment. At the bottom of the analysis you must print the total interest paid to the lending institution.
To vary the assignment, we now want to save some money and earn interest. Suppose we wish to study the effect of time and compounding interest on investments. Add an option to ask the user for:
Starting Principal to invest
Annual Rate of Return (5%, 10%, etc)
Monthly Addition to the Principal
Number of Months to Iterate
The printout will be similar except the column called “payment” will be changed to investment. You should still calculate and print out the total interest and final balance.
This lab exercise should encourage you to start investing early in life.