Question

In: Computer Science

Module 6 Project A: Stereo Payment Calculator You have just purchased a stereo system that cost...

Module 6 Project A: Stereo Payment Calculator

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.

Project Requirements

1. 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 month’s interest on $50 is only 75 cents.

Solutions

Expert Solution

Code to copy:

   #include <iostream>
   #include<string>
   using namespace std;

   int main()
   {
       double loan_amnt, monthly_Pay, interest_Rate;
       double e = 0;
       double amnt, b, l, d, i, interest_Pay;
       //inputting values
       cout << "Enter the amount of the loan: $ ";
       cin >> loan_amnt;
       cout << "Enter the interest per year: ";
       cin >> interest_Pay;
       cout << "Enter the monthly pay: $ ";
       cin >> monthly_Pay;
       l = loan_amnt;
       cout << endl;
       cout << endl;
       cout << endl;
       for(i=1; l>0;i++)
       {
           interest_Rate = interest_Pay/100/12;
           amnt = interest_Rate * l;
           b = monthly_Pay - amnt;
           cout << "Month: " << i << endl;
           cout << "Principle Interest: " << amnt << endl;
           cout << "Principle Remaining: $ " << b << endl;
           l = l - b;
           cout << "You still have a balance of: $ " << l << endl;
           cout << endl ;
           d = e + amnt;
           e = d;
       }
       i = i-1;
       if (l < -0.1)
           l = l * -1;
       else if (l > 0.1)
           l = l * l;
       //outputting data
       cout << "\nThe total month is: " << i << endl;
       cout << "\nThe total Interest paid is: " << d << endl;
       cout << "\nYou have a credit of: " << l << endl;
       //pause system for a while
       system ("pause") ;
       return 0;
   }

Code Screenshot:

Sample Output Screenshot:


Related Solutions

You just purchased a $400,000 house and gave a 20% down payment. For the remaining portion,...
You just purchased a $400,000 house and gave a 20% down payment. For the remaining portion, you obtained a 30-year mortgage at a 6% interest rate. (6 points) What are the monthly payments on this mortgage? If the house appreciates at a 3 percent annually, what will be the value of the house in ten years? In ten years, how much equity will you have on this home? Answer all questions and show work in Excel. SHOW ME IN EXCEL...
How would you isolate just one stereo-isomer of Emixustat?
How would you isolate just one stereo-isomer of Emixustat?
Plot the function without using a calculator, as you will not have a calculator on the...
Plot the function without using a calculator, as you will not have a calculator on the exams. a. ? = 34 sin ?, from t = 0 to the end of the first cycle only. b. ? = 2sin3?, from t = 0 to the end of the second cycle only. c. ? = 2cos3?, from t = 0 to the end of the second cycle only. d. ? = 2sin??, from t = 0 to the end of the...
Suppose you have just purchased your first home for $300,000. At the time of purchase you could afford to commit 20% of the purchase price to a down-payment
Suppose you have just purchased your first home for $300,000. At the time of purchase you could afford to commit 20% of the purchase price to a down-payment. Suppose over time you paid down the principal of the loan to $220,000 and at that point in time you can no longer make any mortgage payments (i.e., you default on the loan). If the lender were to foreclose on your property and sell it for $190,000, determine the amount of the...
You have just purchased a share of stock for $ 21.03, The company is expected to...
You have just purchased a share of stock for $ 21.03, The company is expected to pay a dividend of $ 0.65 per share in exactly one year. If you want to earn a 9.9 % return on your​ investment, what price do you need if you expect to sell the share immediately after it pays the​ dividend? The price one year from now should be $   (Round to the nearest​ cent.)
You purchased a home 6 years ago using a 4% 30-year mortgage with a monthly payment...
You purchased a home 6 years ago using a 4% 30-year mortgage with a monthly payment of $1072.25. Assuming you want to pay off your mortgage today, how much would you have to pay the lender in order to pay off the outstanding balance on your mortgage loan? Round to the nearest dollar.
The adam smith family just purchased a 350,000 house with an 110,000 down payment and a...
The adam smith family just purchased a 350,000 house with an 110,000 down payment and a 30 year mortgage loan at 6.50% annually, with a monthly compounding. payments are made monthly. What is the remaining balance on the mortage after 15 years?
You have just won the lottery and will receive a lump sum payment of $22.53 million...
You have just won the lottery and will receive a lump sum payment of $22.53 million after taxes. Instead of immediately spending your money, you plan to deposit all of the money into an account that will earn 4.81 percent. If you make equal annual withdrawals for the next 25 years, how much can you withdraw each year starting exactly one year from now? Fancy Cat Products has a project that will cost $250,100 today and will generate monthly cash...
For this part you will need to use your calculator. What is the Monthly Mortgage Payment...
For this part you will need to use your calculator. What is the Monthly Mortgage Payment on a $125,000 Home with an 80% LTV with a 5% Interest Rate, 30-Year Fixed Rate Mortgage (Constant Payment Mortgage)? $536.82 What is the Monthly Mortgage Payment on a $125,000 Home with an 80% LTV with a 6% Interest Rate, 30-Year Fixed Rate Mortgage (Constant Payment Mortgage)? $599.55 How much more with the person with the mortgage in question #8 pay over the person...
module 6 discussed the relationship between marginal cost and average cost. Specifically it stated that when...
module 6 discussed the relationship between marginal cost and average cost. Specifically it stated that when marginal cost is above average cost, average cost rises. Describe why this is the case? What happens when marginal cost is below average cost?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT