Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please looking for a simple C++ CODE A You have just purchased a stereo system that cost $1,000 on the following credit plan: no down

Please looking for a simple C++ CODE

A

You have just purchased a stereo system that cost $1,000 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.

Debt0= 1000

Interestn = Debtn*0.015

Principaln = 50 - Interestn

Debtn+1 = Debtn - Principaln

Hence, the first month you pay 1.5% of $1,000 in interest. That is $15 in interest. So, 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 user-defined function that will tell you how many months it will take you to pay off the loan, as well as the total amount of interest paid over the life of the loan.

Use a loop to calculate the amount of interest and the size of the debt after each month. (Your final function need not output the monthly amount of interest paid and remaining debt, but you may want to write a preliminary version of the program that does output these values.)

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.

Do not forget the interest on the last payment. 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.

B

part A user-defined function worked only for finding how many months it will take you to pay off a $1000 loan and the total amount of interest paid over the life of the loan that had an interest of 1.5%. In this project you will be modifying your Module 6 Project A solution to create a generic payment calculator that will require a loan amount, a monthly payment amount, and the interest rate of the loan and then tell you how many months it will take to pay off the loan, as well as the total amount of interest paid over the life of the loan.

Write a function that will tell you how many months it will take you to pay off the loan, as well as the total amount of interest paid over the life of the loan.

  • Use a loop to calculate the amount of interest and the size of the debt after each month. (Your final function need not output the monthly amount of interest paid and remaining debt, but you may want to write a preliminary version of the program that does output these values.)
  • 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 the monthly payment amount.
  • Do not forget the interest on the last payment. If you owe the monthly payment amount, then your monthly payment will not pay off your debt, although it will come close. One months interest on your monthly payment is only the interest rate multiplied by the monthly payment.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions