Write a program that generates a customized loan amortization table. Your progra
ID: 3544601 • Letter: W
Question
Write a program that generates a customized loan amortization table. Your program will prompt the user to enter the amount borrowed (the principal), the annual interest rate, and the number of payments (n). To calculate the monthly payment, it will use the following formula:
payment = (i * P) / (1 - (1 + i)^(-n)), where
P = principal (the amount borrowed),
i = monthly interest rate (1/12 of the annual rate)
n = total number of payments.
This payment must be rounded up to the nearest cent. After the payment was rounded, the program will write to the output file n lines showing how the debt is paid off. Each month part of the payment is the monthly interest on the principal balance, and the rest is applied to the principal. Because the payment and each month's interest are rounded up to the nearest cent, the final payment will be a bit different and must be calculated as the sum of the final interest payment and the final principal balance.
Because the interest is not compounded, it is not very useful to round it up or down monthly. The customer is paying the fixed amount of interest, which is simply rounded to the nearest cent.
============= START OF SAMPLE RUN =======================
Please enter the principal:
1000
Please enter the annual interest:
9
Please enter the number of monthly payments:
6
LOAN AMORTIZATION TABLE
Principal $ 1000.00 Payment $171.07
Annual Interest 9.0% Term 6 months
Payment Number Toward Interest Toward Principal Principal
1 $ 7.50 $163.57 $ 836.43
2 $ 6.27 $164.80 $ 671.63
3 $ 5.04 $166.03 $ 505.60
4 $ 3.79 $167.28 $ 338.32
5 $ 2.54 $168.53 $ 169.79
6 $ 1.27 $169.79 $ 0.00
Final payment: $171.06
============= END OF SAMPLE RUN =======================
Explanation / Answer
============= START OF SAMPLE RUN =======================
Please enter the principal:
0
Please enter the annual interest:
0
Please enter the number of monthly payments:
0
LOAN AMORTIZATION TABLE
Principal $ 0.00 Payment $ 0.00
Annual Interest 0.0% Term 0 months
Payment Number Toward Interest Toward Principal Principal
Final payment: $ 0.00
============= END OF SAMPLE RUN =======================
============= START OF SAMPLE RUN =======================
Please enter the principal:
15000
Please enter the annual interest:
3.2
Please enter the number of monthly payments:
48
LOAN AMORTIZATION TABLE
Principal $15000.00 Payment $333.35
Annual Interest 3.2% Term 48 months
Payment Number Toward Interest Toward Principal Principal
1 $ 40.00 $293.35 $14706.65
2 $ 39.22 $294.13 $14412.52
3 $ 38.43 $294.92 $14117.60
4 $ 37.65 $295.70 $13821.90
5 $ 36.86 $296.49 $13525.41
6 $ 36.07 $297.28 $13228.13
7 $ 35.28 $298.07 $12930.06
8 $ 34.48 $298.87 $12631.19
9 $ 33.68 $299.67 $12331.52
10 $ 32.88 $300.47 $12031.05
11 $ 32.08 $301.27 $11729.78
12 $ 31.28 $302.07 $11427.71
13 $ 30.47 $302.88 $11124.83
14 $ 29.67 $303.68 $10821.15
15 $ 28.86 $304.49 $10516.66
16 $ 28.04 $305.31 $10211.35
17 $ 27.23 $306.12 $ 9905.23
18 $ 26.41 $306.94 $ 9598.29
19 $ 25.60 $307.75 $ 9290.54
20 $ 24.77 $308.58 $ 8981.96
21 $ 23.95 $309.40 $ 8672.56
22 $ 23.13 $310.22 $ 8362.34
23 $ 22.30 $311.05 $ 8051.29
24 $ 21.47 $311.88 $ 7739.41
25 $ 20.64 $312.71 $ 7426.70
26 $ 19.80 $313.55 $ 7113.15
27 $ 18.97 $314.38 $ 6798.77
28 $ 18.13 $315.22 $ 6483.55
29 $ 17.29 $316.06 $ 6167.49
30 $ 16.45 $316.90 $ 5850.59
31 $ 15.60 $317.75 $ 5532.84
32 $ 14.75 $318.60 $ 5214.24
33 $ 13.90 $319.45 $ 4894.79
34 $ 13.05 $320.30 $ 4574.49
35 $ 12.20 $321.15 $ 4253.34
36 $ 11.34 $322.01 $ 3931.33
37 $ 10.48 $322.87 $ 3608.46
38 $ 9.62 $323.73 $ 3284.73
39 $ 8.76 $324.59 $ 2960.14
40 $ 7.89 $325.46 $ 2634.68
41 $ 7.03 $326.32 $ 2308.36
42 $ 6.16 $327.19 $ 1981.17
43 $ 5.28 $328.07 $ 1653.10
44 $ 4.41 $328.94 $ 1324.16
45 $ 3.53 $329.82 $ 994.34
46 $ 2.65 $330.70 $ 663.64
47 $ 1.77 $331.58 $ 332.06
48 $ 0.89 $332.06 $ 0.00
Final payment: $332.95
============= END OF SAMPLE RUN =======================
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.