I'm currently writing a mortgage calculator for a class project, but I'm having an issue with outputting it to a file. I need to output monthly payments in a table format(which I believe I have the formatting correct), but the for loop is not outputting anything. It should be outputting as long as i is less than t which is the term of the loan from years to months.
Any ideas on where I go from here? Apologies for the messy code by the way.
Ah thanks kenmort, didn't even notice that mistake.
I'm having an additional problem that might be an easy fix, but I'm not sure where to go with it.
My total interest is outputting as higher than P (it's P + monthly payment).
How do I calculate Total Interest: (MP * T) - P (where P is the initial value, not the value after the loop)?
As a guess, because I haven't looked at you methodology all that closely, I would reckon that in pseudocode:
a) total interest = total payments - principal
b) total payments = monthly payments * no of months ( assuming payments per month are constant )
So it appears we might agree.
a) is more general and b) requires you to keep a running total if payments in lieu if they aren't the same each month, or alternatively you can use the standard equations for summing geometric progressions where the payments are based on the principal owing and therefore vary from payment to payment etc :)