0
Hey all I'm having trouble with loops again and this time it is for loops. I need to calculate monthly balance and interest paid on a balloon mortgage and am having trouble with the calculations. An example of what the program should look like:
Enter Mortgage: 100000
Enter Interest Rate: 5
Enter Payment Amount: 1000
Enter Number of Years for Loan: 5
Month Balance Payment Interest
1 100000.00 1000.00 412.50
2 99412.50 1000.00 410.05



60 60797.27 1000.00 249.16
Balloon Payment: 60046.43
Here is my code so far:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double mortgage, interest, payment, years, monthlyInterest, monthlyBalance, numPayments;
int counter;
cout << "Please enter a mortgage amount: ";
cin >> mortgage;
cout << "Please enter an annual interest rate: ";
cin >> interest;
cout << "Please enter a payment amount: ";
cin >> payment;
cout << "Please enter number of years for the loan: ";
cin >> years;
monthlyInterest = ((mortgage  payment) * interest / 12);
monthlyBalance = ((mortgage  payment) + monthlyInterest);
numPayments = (years * 12);
cout << "Month" << '\t' << "Balance" << '\t' << '\t' << "Payment" << '\t'<< '\t' << "Interest" << endl;
for (counter = 1; counter <= numPayments; counter++)
{
cout << counter << '\t' << setiosflags(ios::fixed) << setprecision(2) << monthlyBalance << '\t' << payment << '\t' << '\t' << setiosflags(ios::fixed) << setprecision(2) << monthlyInterest << endl;
}
}