You have just purchased a stereo system that cost $1000 on the following credit plan:no down payment, an interest rate of 18% per year (and hence 1.5% per month), andmonthly payments of $50. The monthly payment of $50 is used to pay the interest, andwhatever is left is used to pay part of the remaining debt. Hence, the first month youpay 1.5% of $1000 in interest. That is $15 in interest. The remaining $35 is deductedfrom your debt, which leaves you with a debt of $965.00. The next month you payinterest 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.Write a program that will tell you how many months it will take you to pay off this loanin particular and any loan in general. Your program also needs to calculate the totalamount of interest paid over the life of any loan. Use a loop to calculate the amount ofinterest and the size of the debt after each month. Your program must output themonthly amount of interest paid and remaining debt. Use a variable to count thenumber of loop iterations and hence the number of months until the debt is zero. Youmay want to use other variables as well. The last payment may be less than $50 if thedebt is small, but do not forget the interest. If you owe $50, then your monthly paymentof $50 will not pay off your debt, although it will come close. One months interest on$50 is only 75 cents.Here is a sample dialog (where the user input is depicted as Bold, but you do not needto display user input in bold.):Loan Amount: 1000Interest Rate (% per year): 18Monthly Payments: 502Your programs output should match the style of the sample output (including a leftlined-up style).In what follows, you find a second case used to test the correctness of your program.******************************************************Amortization Table******************************************************Month Balance Payment Rate Interest Principal0 $1000.00 N/A N/A N/A N/A1 $965.00 $50.00 1.5 $15.00 $35.002 $929.48 $50.00 1.5 $14.47 $35.533 $893.42 $50.00 1.5 $13.94 $36.064 $856.82 $50.00 1.5 $13.40 $36.605 $819.67 $50.00 1.5 $12.85 $37.156 $781.97 $50.00 1.5 $12.30 $37.707 $743.70 $50.00 1.5 $11.73 $38.278 $704.85 $50.00 1.5 $11.16 $38.849 $665.42 $50.00 1.5 $10.57 $39.4310 $625.40 $50.00 1.5 $9.98 $40.0211 $584.79 $50.00 1.5 $9.38 $40.6212 $543.56 $50.00 1.5 $8.77 $41.2313 $501.71 $50.00 1.5 $8.15 $41.8514 $459.24 $50.00 1.5 $7.53 $42.4715 $416.13 $50.00 1.5 $6.89 $43.1116 $372.37 $50.00 1.5 $6.24 $43.7617 $327.95 $50.00 1.5 $5.59 $44.4118 $282.87 $50.00 1.5 $4.92 $45.0819 $237.11 $50.00 1.5 $4.24 $45.7620 $190.67 $50.00 1.5 $3.56 $46.4421 $143.53 $50.00 1.5 $2.86 $47.1422 $95.68 $50.00 1.5 $2.15 $47.8523 $47.12 $50.00 1.5 $1.44 $48.5624 $0.00 $47.83 1.5 $0.71 $47.12******************************************************It takes 24 months to pay off the loan.Total interest paid is: $197.83Loan Amount: 2000Interest Rate (% per year): 12Monthly Payments: 803Special Cases:1. Please think about how to deal with the last payment, which is smaller thanregular 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 larger than anymonthly interest. For example, in the above amortization table, your programmust test if the regular monthly payment (i.e., $80.00) is larger than themonthly interest (e.g., $20.00 in the first month).3. If you do not address the above issue, your program may not terminate in somespecial cases. See the example below:
COMP2710
[Solved] COMP2710 Project 1-stereo system
$25
File Name: COMP2710_Project_1-stereo_system.zip
File Size: 301.44 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.