如果我们使用给定的公式设法按固定的利率和贷款额变量来获取每月还款额,那么如果给出每月还款额,如何获得以年为单位的总每月还款额?
// r is the percentage rate per period divided by 100
// n is numbers of years * 12 / number of payments
// Principal amount = House value * ( 90 / 100 )
// payment = ((Principal amount * (1 + r/12) ^ n) * r) / (12 * ((1 + r/12)^n - 1)));
double loanAmount = (double)txtLoanAmount.Currentvalue * ((double)txtFinancing.Currentvalue / 100); // house value * % Financing
double interestRate = (double)udInterest.Value / 100; // calculate interest from 100%
double termOfLoan = (double)(udTerm.Value * 12); // monthly term
double payment;
payment = (loanAmount) * (Math.Pow((1 + interestRate / 12),termOfLoan) * interestRate) / (12 * (Math.Pow((1 + interestRate / 12),termOfLoan) - 1));
txtPayment.Text = payment.ToString("N2");