I just did this and I am not sure I am doing this correctly.

You have purchased a stereo system that cost $1000 on the following credit plan: no payment down, an interest of 18% per year, 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. So, the remaining $35 is deducted from your debt, which leaves you with a debt of $965.00. And its asking for total payment and total interest.

```
#include <iostream.h>
#include <conio.h>
main()
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
double cost = 1000, annualInterestRate = 0.18, monthlyPayment = 50, monthlyRate, monthlyInterestRate;
double monthlyInterest, towardsPrinciple, payment, totalPayment=0, totalInterest;
while (cost > 0)
{
monthlyInterestRate = annualInterestRate / 12;
monthlyInterest = cost * monthlyInterestRate;
towardsPrinciple = monthlyPayment - monthlyInterest;
cost = cost - towardsPrinciple;
totalInterest = totalInterest + monthlyInterest;
totalPayment = totalPayment + towardsPrinciple + monthlyInterest;
if (cost + monthlyInterest >= monthlyPayment)
payment = monthlyPayment;
else
payment = cost + monthlyInterest;
}
cout << "The total payment is " << totalPayment << endl;
cout << "The total interest is " << totalInterest << endl;
getch();
}
```

Thanks