[Solved] COMP2710 Homework 2- Paying off the loan of a stereo system

$25

File Name: COMP2710_Homework_2-_Paying_off_the_loan_of_a_stereo_system.zip
File Size: 555.78 KB

SKU: [Solved] COMP2710 Homework 2- Paying off the loan of a stereo system Category: Tag:
5/5 - (1 vote)

Description:

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), 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.

Write a program that will tell you how many months it will take you to pay off this loan in particular and any loan in general. Your program also needs to calculate the total amount of interest paid over the life of any loan. Use a loop to calculate the amount of interest and the size of the debt after each month. Your program must output the monthly amount of interest paid and remaining debt. Use a variable to count the number of loop iterations and hence the number of months until the debt is zero. You may want to use other variables as well. The last payment may be less than $50 if the debt is small, but do not forget the interest. If you owe $50, then your monthly payment of $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 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 0 $1000.00 N/A N/A N/A N/A 21 $929.48 $50.00 $965.00 $50.00 1.51.5 $14.48 $15.00 $35.53 $35.00 3 $893.42 $50.00 1.5 $13.94 $36.06 4 $856.82 $50.00 1.5 $13.40 $36.605 $819.67 $50.006 $781.97 $50.00 1.51.5 $12.30 $12.85 $37.70 $37.157 $743.70 $50.00 1.5 $11.73 $38.27 8 $704.85 $50.00 1.5 $11.16 $38.84 9 $665.42 $50.00 1.5 $10.57 $39.43 1110 $584.79 $50.00 $625.40 $50.00 1.51.5 $9.38 $9.98 $40.62 $40.02 12 $543.56 $50.00 1.5 $8.77 $41.23 13 $501.71 $50.00 1.5 $8.15 $41.85 1514 $416.13 $50.00 $459.24 $50.00 1.51.5 $6.89 $7.53 $43.11 $42.47 16 $372.37 $50.00 1.5 $6.24 $43.76 17 $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.76 20 $190.67 $50.00 1.5 $3.56 $46.44 21 $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.56 24 $0.00 $47.83 1.5 $0.71 $47.12 ****************************************************** It takes Total interest paid is: 24 months to pay off the loan. $197.83

Your programs output should match the style of the sample output.

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

******************************************************

0Month $2,000.00 Balance N/A Payment Rate N/A N/A Interest Principal N/A

21 $1,879.40 $1,940.00 $80.00 $80.00 11 $19.40 $20.00 $60.60 $60.00

  • $1,818.19 $80.00 1 $18.79 $61.21
  • $1,756.38 $80.00 1 $18.18 $61.82
  • $1,693.94 $80.00 1 $17.56 $62.44
  • $1,630.88 $80.00 1 $16.94 $63.06
  • $1,567.19 $80.00 1 $16.31 $63.69
  • $1,502.86 $80.00 1 $15.67 $64.33 9 $1,437.89 $80.00 1 $15.03 $64.97

1110 $1,305.99 $1,372.27 $80.00 $80.00 11 $13.72 $14.38 $66.28 $65.62

1312 $1,171.44 $1,239.05 $80.00 $80.00 11 $12.39 $13.06 $67.61 $66.94

  • $1,103.15 $80.00 1 $11.71 $68.29
  • $1,034.19 $80.00 1 $11.03 $68.97 16 $964.53 $80.00 1 $10.34 $69.66 17 $894.17 $80.00 1 $9.65 $70.35 18 $823.12 $80.00 1 $8.94 $71.06

2019 $678.86 $751.35 $80.00 $80.00 11 $7.51 $8.23 $72.49 $71.77

2221 $531.70 $605.65 $80.00 $80.00 11 $6.06 $6.79 $73.94 $73.21

  • $457.02 $80.00 1 $5.32 $74.68
  • $381.59 $80.00 1 $4.57 $75.43
  • $305.41 $80.00 1 $3.82 $76.18
  • $228.46 $80.00 1 $3.05 $76.95
  • $150.75 $80.00 1 $2.28 $77.72 28 $72.25 $80.00 1 $1.51 $78.49 29 $0.00 $72.98 1 $0.72 $72.25

******************************************************

Total interest paid is: It takes 29 months to pay off the loan. $312.98

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 larger 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).
  3. If you do not address the above issue, your program may not terminate in some special cases. See the example below:

Loan Amount: Interest Rate (% per year): 2000 49.2

Monthly Payments: 80

****************************************************** Amortization Table

******************************************************

0Month $2,000.00 Balance N/A Payment Rate N/A N/A Interest Principal

21 $2,004.08 $2,002.00 $80.00 $80.00 4.14.1 $82.08 $82.00 $2.08 $2.00

  • $2,006.25 $80.00 4.1 $82.17 -$2.17
  • $2,008.51 $80.00 4.1 $82.26 -$2.26
  • $2,010.85 $80.00 4.1 $82.35 -$2.35
  • $2,013.30 $80.00 4.1 $82.45 -$2.45
  • $2,015.84 $80.00 4.1 $82.55 -$2.55
  • $2,018.49 $80.00 4.1 $82.65 -$2.65 9 $2,021.25 $80.00 4.1 $82.76 -$2.76

1110 $2,027.11 $2,024.12 $80.00 $80.00 4.14.1 $82.99 $82.87 $2.99 $2.87

1312 $2,033.46 $2,030.22 $80.00 $80.00 4.14.1 $83.24 $83.11 $3.24 $3.11

  • $2,036.84 $80.00 4.1 $83.37 -$3.37
  • $2,040.35 $80.00 4.1 $83.51 -$3.51
  • $2,044.00 $80.00 4.1 $83.65 -$3.65
  • $2,047.80 $80.00 4.1 $83.80 -$3.80
  • $2,051.76 $80.00 4.1 $83.96 -$3.96
  • $2,055.89 $80.00 4.1 $84.12 -$4.12

Programming Environment:

Write a short program in C++.

Requirements:

  1. Use comments to provide a heading at the top of your code containing your name, Auburn Userid, filename. And pair partners info, if applicable. Also describe any help or sources that you used (as per the syllabus).

// name: Sally Ride, szr0001

// partner: Lizz Jones, lzj0001 (NONE if work alone)

// filename: hw01.cpp

// due date: 08/31/2018 // problem: determine how much diet soda it is possible to drink // without dying as a result

// collaboration: I got help with data types from the TA.

(OR I did not use any external sources for this assignment.)

  1. Your source code file should be named as hw2.cpp. 3. (10 points) No compilation error and no warning messages
  1. Use modifier const for the fraction.
  2. Usability of your program (e.g., input and output)
  3. Quality of your source code.

You will lose points if you: do not use the specific program file name, or do not have a comment block on EVERY program you hand in. You will lose at least 40 points if there are compilation errors or warning messages when we compile your source code.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COMP2710 Homework 2- Paying off the loan of a stereo system
$25