Description
Points Possible: 100
Note: You do not need to submit hard copies.
Goals:
• To learn how to implement the concept of “Flow of Control” in C++.
• To write a very simple C++ program.
Description:
You have just purchased a stereo system that costs $1000 on the following credit plan: no down payment, an interest rate of 18% per year (and hence 1.5% per month), and monthly payments of $50. The monthly payment of $50 is used to pay the interest, and whatever is left is used to pay part of the remaining debt. Hence, the first month you pay 1.5% of $1000 in interest. That is $15 in interest. The remaining $35 is deducted from your debt, which leaves you with a debt of $965.00. The next month you pay interest of 1.5% of $965.00, which is $14.48. Hence, you can deduct $35.52 (which is $50–$14.48) from the amount you owe.
Here is a sample dialog (where the user input is depicted as Bold, but you do not need to display user input in bold.):
Loan Amount: 1000
Interest Rate (% per year): 18 Monthly Payments: 50 ********************************************************** Amortization Table
**********************************************************
Month Balance Payment Rate Interest Principal
01 $1000.00$965.00 $50.00N/A 1.50N/A $1N/A5.00 N/A$35.00
2 $929.47 $50.00 1.50 $14.47 $35.53
3 $893.42 $50.00 1.50 $13.94 $36.06
4 $856.82 $50.00 1.50 $13.40 $36.60
56 $819.67$781.97 $50.00$50.00 1.501.50 $12.85$12.30 $37.15$37.70
7 $743.70 $50.00 1.50 $11.73 $38.27
8 $704.85 $50.00 1.50 $11.16 $38.84
910 $665.42$625.40 $50.00$50.00 1.501.50 $10.57$9.98 $39.43$40.02
11 $584.79 $50.00 1.50 $9.38 $40.62
12 $543.56 $50.00 1.50 $8.77 $41.23
13 $501.71 $50.00 1.50 $8.15 $41.85
1415 $459.24$416.13 $50.00$50.00 1.501.50 $7.53$6.89 $42.47$43.11
16 $372.37 $50.00 1.50 $6.24 $43.76
17 $327.95 $50.00 1.50 $5.59 $44.41
1819 $282.87$237.11 $50.00$50.00 1.501.50 $4.92$4.24 $45.08$45.76
20 $190.67 $50.00 1.50 $3.56 $46.44
21 $143.53 $50.00 1.50 $2.86 $47.14
22 $95.68 $50.00 1.50 $2.15 $47.85
2324 $47.12$0.00 $50.00$47.83 1.501.50 $1.44$0.71 $48.56$47.12
**********************************************************
ItTotal takes interest 24 months paid to is: pay $197.83 off the loan.
Your program’s output should match the style of the sample output (including a left lined-up style).
In what follows, you find a second case used to test the correctness of your program.
Loan Amount: 2000
Interest Rate (% per year): 12 Monthly Payments: 80 ******************************************************** Amortization Table
********************************************************
Month0 Balance$2,000.00 PaymentN/A RateN/A InterestN/A PrincipalN/A
12 $1,940.00$1,879.40 $80.00$80.00 1.001.00 $20.00$19.40 $60.00$60.60
3 $1,818.19 $80.00 1.00 $18.79 $61.21
4 $1,756.38 $80.00 1.00 $18.18 $61.82
5 $1,693.94 $80.00 1.00 $17.56 $62.44
6 $1,630.88 $80.00 1.00 $16.94 $63.06
7 $1,567.19 $80.00 1.00 $16.31 $63.69
8 $1,502.86 $80.00 1.00 $15.67 $64.33
9 $1,437.89 $80.00 1.00 $15.03 $64.97
1011 $1,372.27$1,305.99 $80.00$80.00 1.001.00 $14.38$13.72 $65.62$66.28
1213 $1,239.05$1,171.44 $80.00$80.00 1.001.00 $13.06$12.39 $66.94$67.61
14 $1,103.15 $80.00 1.00 $11.71 $68.29
15 $1,034.19 $80.00 1.00 $11.03 $68.97
16 $964.53 $80.00 1.00 $10.34 $69.66
17 $894.17 $80.00 1.00 $9.65 $70.35
18 $823.11 $80.00 1.00 $8.94 $71.06
19 $751.35 $80.00 1.00 $8.23 $71.77
20 $678.86 $80.00 1.00 $7.51 $72.49
2122 $605.65$531.70 $80.00$80.00 1.001.00 $6.79$6.06 $73.21$73.94
2324 $457.02$381.59 $80.00$80.00 1.001.00 $5.32$4.57 $74.68$75.43
25 $305.41 $80.00 1.00 $3.82 $76.18
26 $228.46 $80.00 1.00 $3.05 $76.95
27 $150.75 $80.00 1.00 $2.28 $77.72
28 $72.25 $80.00 1.00 $1.51 $78.49
29 $0.00 $72.98 1.00 $0.72 $72.25
********************************************************
ItTotal takes interest 29 months paid to is: pay $312.98 off the loan.
Special Cases:
1. Please think about how to deal with the last payment, which is smaller than regular payment. For example, in the above table, the regular payments are $80.00 whereas the last payment is only 72.98.
2. Your program needs to ensure that regular payments are greater than any monthly interest. For example, in the above amortization table, your program must test if the regular monthly payment (i.e., $80.00) is larger than the monthly interest (e.g., $20.00 in the first month), otherwise your program should ask for a larger monthly payment.
3. Make sure that the loan amount and monthly payment are positive numbers and interest rate is a non-negative number.
LoanInterest Amount: Rate 2000 (% per year): 49.2
Monthly Payments: 80
******************************************************** Amortization Table
********************************************************
Month Balance Payment Rate Interest Principal
0 $2,000.00 N/A N/A N/A N/A
12 $2,002.00$2,004.08 $80.00$80.00 4.104.10 $82.00$82.08 –$2.00$2.08
3 $2,006.25 $80.00 4.10 $82.17 -$2.17
4 $2,008.51 $80.00 4.10 $82.26 -$2.26
5 $2,010.85 $80.00 4.10 $82.35 -$2.35
6 $2,013.30 $80.00 4.10 $82.45 -$2.45
7 $2,015.84 $80.00 4.10 $82.55 -$2.55
8 $2,018.49 $80.00 4.10 $82.65 -$2.65
9 $2,021.25 $80.00 4.10 $82.76 -$2.76
1011 $2,024.12$2,027.11 $80.00$80.00 4.104.10 $82.87$82.99 –$2.87$2.99
1213 $2,030.22$2,033.46 $80.00$80.00 4.104.10 $83.11$83.24 –$3.11$3.24
14 $2,036.84 $80.00 4.10 $83.37 -$3.37
15 $2,040.35 $80.00 4.10 $83.51 -$3.51
16 $2,044.00 $80.00 4.10 $83.65 -$3.65
17 $2,047.80 $80.00 4.10 $83.80 -$3.80
18 $2,051.76 $80.00 4.10 $83.96 -$3.96
19 $2,055.89 $80.00 4.10 $84.12 -$4.12
… … … … …
Programming Environment:
Write a short program in C++. Compile and run it using AU server (no matter what kind of text editor you use, please make sure your code could run on AU server, the only test bed we accept is AU server).
Requirements:
1 (5 points) Use comments to provide a heading at the top of your code containing your name, Auburn UserID, filename, and how to compile your code. Also describe any help or sources that you used (as per the syllabus).
2 (5 points) Your source code file should be named as
“project1_LastName_UserID.cpp” (e.g. project1_Liu_tzl0031.cpp).
4 (10 points) Usability of your program (e.g., input and output).
5 (40 points) Quality of your source code (Pass all provided test cases).
Deliverables:
• A heading at the top of your code contains your name, Auburn UserID, filename, and how to compile your code.
• Submit your source code file named as “project1_LastName_UserID.cpp” through the Canvas system.
• For more than one submission, the system will automatically add a hyphen to your file name. i.e. project1_LastName_UserID-#.cpp. Please ignore this issue. Late Submission Penalty:
Rebuttal period:
Reviews
There are no reviews yet.