Question: Write the complete HTML5 and JavaScript codes that calculates the payment details when a person applies for a house loan. Save your file as Q3.html.
Write the complete HTML5 and JavaScript codes that calculates the payment details when a person applies for a house loan. Save your file as Q3.html. The screenshot below depicts the interface of the web page.
Use will have to enter as input property price, down payment, loan period (years), as well as the annual interest rate (%). When the CALCULATE button is clicked, the web page will display below as output how much the person must pay monthly (monthly payment), as well as the total payment paid and total interest paid throughout the years. The screenshot below depicts the sample input entered and the output generated (displayed).
JavaScript requirements:
Declare necessary variables.
When the CALCULATE button is clicked, call function calcMonthlyPayment( ). In function calcMonthlyPayment( ):
o Extract all the four (4) inputs.
o Calculate P, representing the principal amount borrowed.
o Calculate i, representing the monthly interest rate.
o Calculate n, representing loan tenure in months.
o Calculate monthly payment.
o Calculate the total payment that the person would have paid throughout the years. o Calculate the total interest that the person would have paid throughout the years.
Formulas:
P = principal (property price minus down payment).
i = monthly interest rate (convert annual interest rate (%) into decimal and divide by 12). n = loan tenure in months (multiply loan period (years) by 12 and negative 1 to convert it to a negative number)
Monthly payment =P*(i/(1-(1+i)**-n))
Note: Please try to figure out the formulas for the total amount paid and total interest paid.

HOME LOAN CALCULATOR Header 2 Property Price (RM): Down Payment (RM): Loan Period (Years): Interest Rate (%): Table with 4 rows and 2 columns CALCULATE MONTHLY PAYMENT (RM): TOTAL PAYMENT PAID (RM): TOTAL INTEREST PAID (RM): Table with 3 rows and 2 columns DU o 57 cao 80 F3 DOO Fa & % C 7 7. 8 8 CA S 6 5 payment paid and total interest paid throughout the years. The screenshot bel depicts the sample input entered and the output generated (displayed). HOME LOAN CALCULATOR Property Price (RM): 500000 Down Payment (RM): 50000 Loan Period (Years): 3 Interest Rate (%); 4.25 CALCULATE MONTHLY PAYMENT (RM): 2060.52 TOTAL PAYMENT PAID (RM): 865419.65 TOTAL INTEREST PAID (RM): 415419.65 E ables. When the CALLULATE button is clicked, call function calc Monthly Payment): In function calc Monthly Payment(): o Extract all the four (4) inputs. Calculate P, representing the principal amount borrowed. laminte de montantes ODO 000 53 80 F3 A & $ % 8 9 7 6 5 3 4 n Y T
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
