Question: Write an HTML document that looks similar to Write four functions with these headers: function doPayment() function doBalance() function computePayment(principal, annualRate, years, periodsPerYear) function computeBalance(principal,
Write an HTML document that looks similar to
Write four functions with these headers:
function doPayment() function doBalance() function computePayment(principal, annualRate, years, periodsPerYear) function computeBalance(principal, annualRate, years, periodsPerYear, numberOfPaymentsPaidToDate)
The first two functions (doPayment and doBalance)
take no parameters
are called from an onclick attribute
get input from the user
call the computePayment or the computeBalance function
display a result to the user
The computePayment function computes and returns the monthly payment for a loan with a fixed annual interest rate. The formula for computing a loan payment is
p=ar1(1+r)np=ar1-(1+r)-n {"version":"1.1","math":""}
where p is the payment per period, a is the loan amount, r is the interest rate per period, and n is the total number of periods throughout the life of the loan.
The computeBalance function computes and returns the balance for a loan with a fixed annual interest rate. The formula for computing the balance of a loan after n payments have been made is
b=a(1+r)np((1+r)n1)rb=a(1+r)n-p((1+r)n-1)r {"version":"1.1","math":""}
where b is the balance or payoff amount, a is the loan amount, r is the interest rate per period, p is the payment per period, and n is the number of payments paid to date.
Hints
To simplify potential troubleshooting of your equations, try splitting the formulas into several different JavaScript statements.
You may want to review Chapter 5 for examples of converting formulas into JavaScript code.
Dont confuse annual interest rate with interest rate per period. The annual interest rate is the rate per year, and the interest rate per period is the annual interest rate divided by the number of periods per year.
Loan Calculator x 9 file:///C/Users/rab29/Dropbox/books/handboola * Loan Calculator Amount borrowed (principal) Annual interest rate (example: .065) Number of years Payments per year Compute payment Number of payments paid to date 80000 0.05 30 12 $429.46 180 $54306.40 Compute payoff amount ResetStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
