Ok, so what I have to do is get the interest rate, monthly pay, remaining balance, and interest paid for each month for 12 months. But when I execute the code, I get the all of those things for month 1 but its the same for all 12 months (Doing a For Loop). I dont know how to even get the 4 new things for all 12 months. I spent an hour trying to figure this out LOL. (Started c++ programming a week and a half ago). Heres the code:
I tried puting "new balance" and "new monthly pay" as variables and put the same equations in thinking the loop will keep storing the new numbers in them but that didnt work either. What am I doing wrong?Code:float monthly_rate = .02; float anual_rate = .2; float balance = 4800; float length = 12; for (int month = 2; month != 13; ++month) { cout << "Month: " << month << endl; float monthly_pay = monthly_rate * balance; float interest_paid = anual_rate / length * balance; float principal_paid = monthly_pay - interest_paid; float remaining_balance = balance - principal_paid; cout << "Monthly Payment is: " << monthly_pay << endl; cout << "Interest Paid is : " << interest_paid << endl; cout << "Principal Paid is: " << principal_paid << endl; cout << "Remaining Balance is: " << remaining_balance << endl; }



LinkBack URL
About LinkBacks


