Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have just purchased a stereo system that costs $1000 on thefollowing credit

ID: 3608919 • Letter: Y

Question

You have just purchased a stereo system that costs $1000 on thefollowing credit plan: No down payment, an interest rate of 18% peryear (and hence 1.5% per month), and monthly payments of $50. Themonthly payment of $50 is used to pay the interest and whatever isleft is used to pay part of the remaining debt. Hence, the firstmonth you pay 1.5% of $1000 in interest. That is $15 in interest.So, the remaining $35 is deducted from your debt which leaves youwith 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 youto pay off the loan, as well as the total amount of interest paidover the life of the loan. Use a loop to calculate the amount ofinterest and the size of the debt after each month. Put out themonthly amount of interest paid and remaining debt. Use a variableto count the number of loop iterations and hence the number ofmonths until the debt is zero. You may want to use other variablesas well.

So for I have this, but I am computing the total interest paidwrong hoe can I fix it?

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

int main()
{
double loan,yrint,mpay,sumtin;
double decint,prince;
int month;

cout << "Enter the amount of loan: ";
cin >> loan;
cout << "Enter the yearly interest: ";
cin >> yrint;
cout << "Enter the monthly amount paid: ";
cin >> mpay;
cout<<endl;
cout << "Month";
cout << setw(20) << "Princpal Interest";
cout << setw(10) << "Paid";
cout << setw(20) << "Principal Paid";
cout << setw(20) << "Remaining Balance" <<endl;

for (month=0;loan>0;month++)
{
decint = yrint/100/12;
sumtin = (loan*decint*100+5)/100;
prince = mpay + sumtin;
loan = loan - prince;

cout << fixed << showpoint <<setprecision(2);
cout << setw(4) <<month;
cout << setw(17) << loan;
cout << setw(15) << sumtin;
cout << setw(15) << prince;
cout << setw(20) << loan;
cout << endl;
}

cout << "The total months you need to pay off is " <<month << endl;
cout << "Total interest paid on loan " << prince << endl;
cout << "You have a credit of " << loan <<endl;

return 0;
}

Explanation / Answer

int main()
{
double loan,yrint,mpay,sumtin,total,intotal;
double decint,prince;
int month;

cout << "Enter the amount of loan: ";
cin >> loan;
cout << "Enter the yearly interest: ";
cin >> yrint;
cout << "Enter the monthly amount paid: ";
cin >> mpay;
cout<<endl;
cout << "Month";
cout << setw(20) << "Princpal Interest";
cout << setw(10) << "Paid";
cout << setw(20) << "Principal Paid";
cout << setw(20) << "Remaining Balance" <<endl;
cin.get();

for (month=0;loan>0;month++)
{
decint = (yrint/100)/12;
sumtin = (loan*decint);
prince = mpay - sumtin;
intotal=intotal+sumtin;
total=loan;
loan =loan-prince;

cout << setw(4)<<month;
cout << setw(17) << total;
cout << setw(15) << sumtin;
cout << setw(15) << prince;
cout << setw(20) << loan;
cout << endl;
}

cout << "The total months you need to pay off is " <<month << endl;
cout << "Total interest paid on loan " << intotal<< endl;
cout << "You have a credit of " << loan <<endl;
cin.get();

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote