Lab 2-Option2Due: Thu, Feb 8, 11:59pm
|
Interest on a loan is paid on a declining balance, and hence a loan with an interest rate of, say, 14% can cost significantly less than 14% of the balance. Write a program that takes a loan amount and interest rate as input and then outputs the monthly payments and balance of the loan until the loan is paid off. Assume that the monthly payments are one-twentieth (1/20th) of the original loan amount, and that any amount in excess of the interest is credited toward decreasing the balance due. Thus, on a loan of $20,000, the payments would be $1,000 a month. If the interest rate is 10%, then each month the interest is one-twelfth of 10% of the remaining balance. The first month, (10% of $20,000)/12, or $166.67, would be paid in interest, and the remaining $833.33 would decrease the balance to $19,166.67. The following month the interest would be (10% of $19,166.67)/12, and so forth. Also have the program output the total interest paid over the life of the loan.
For each input, please print out a full amortization table as seen in the example below. Your program should ask for a loan amount, and an interest percentage. The output should be in fixed number format with 2 digit after the decimal point.
Turn in runs with the following inputs:
Two sample runs are given below:
A $20000.00 loan at 10.00% interest.
# PAYMENT PRINCIPAL INTEREST TOTAL INTEREST BALANCE
1 1000.00 833.33 166.67 166.67 19166.67
2 1000.00 840.28 159.72 326.39 18326.39
3 1000.00 847.28 152.72 479.11 17479.11
4 1000.00 854.34 145.66 624.77 16624.77
5 1000.00 861.46 138.54 763.31 15763.31
6 1000.00 868.64 131.36 894.67 14894.67
7 1000.00 875.88 124.12 1018.79 14018.79
8 1000.00 883.18 116.82 1135.61 13135.61
9 1000.00 890.54 109.46 1245.08 12245.08
10 1000.00 897.96 102.04 1347.12 11347.12
11 1000.00 905.44 94.56 1441.68 10441.68
12 1000.00 912.99 87.01 1528.69 9528.69
13 1000.00 920.59 79.41 1608.10 8608.10
14 1000.00 928.27 71.73 1679.83 7679.83
15 1000.00 936.00 64.00 1743.83 6743.83
16 1000.00 943.80 56.20 1800.03 5800.03
17 1000.00 951.67 48.33 1848.36 4848.36
18 1000.00 959.60 40.40 1888.77 3888.77
19 1000.00 967.59 32.41 1921.17 2921.17
20 1000.00 975.66 24.34 1945.52 1945.52
21 1000.00 983.79 16.21 1961.73 961.73
22 969.74 961.73 8.01 1969.74 0.00
Payoff in 22 months (1.83) years
The annualized interest is: $1074.41 a year, or 5.37% a year
Amount Loaned: 8500
Interest Rate: .0775
A $8500.00 loan at 7.75% interest.
# PAYMENT PRINCIPAL INTEREST TOTAL INTEREST BALANCE
1 425.00 370.10 54.90 54.90 8129.90
2 425.00 372.49 52.51 107.40 7757.40
3 425.00 374.90 50.10 157.50 7382.50
4 425.00 377.32 47.68 205.18 7005.18
5 425.00 379.76 45.24 250.42 6625.42
6 425.00 382.21 42.79 293.21 6243.21
7 425.00 384.68 40.32 333.53 5858.53
8 425.00 387.16 37.84 371.37 5471.37
9 425.00 389.66 35.34 406.70 5081.70
10 425.00 392.18 32.82 439.52 4689.52
11 425.00 394.71 30.29 469.81 4294.81
12 425.00 397.26 27.74 497.55 3897.55
13 425.00 399.83 25.17 522.72 3497.72
14 425.00 402.41 22.59 545.31 3095.31
15 425.00 405.01 19.99 565.30 2690.30
16 425.00 407.63 17.37 582.67 2282.67
17 425.00 410.26 14.74 597.42 1872.42
18 425.00 412.91 12.09 609.51 1459.51
19 425.00 415.57 9.43 618.93 1043.93
20 425.00 418.26 6.74 625.68 625.68
21 425.00 420.96 4.04 629.72 204.72
22 206.04 204.72 1.32 631.04 0.00
Payoff in 22 months (1.83) years
The annualized interest is: $344.20 a year, or 4.05% a year
Remember: You need to follow the guidelines on Program Style described in section 2.5 of the textbook. ( See guidelines here).
Requirement | Grading Comments | Points | Score |
---|---|---|---|
Run examples with correct output on required trial data | 50 | ||
Good clean, easy to read and understand input and output format | 15 | ||
Complete source code with good formatting, variable names, and comments | 10 | ||
Total | 75 |