JavaScript: Loan Calculator
Create an HTML5 project that will compute the payment on a loan. The user should be allowed to input the following:
1. Loan amount
2. Interest rate
3. Years
Each of the input boxes should be labeled. There should be two buttons:
1. A Compute Payment button
2. A Clear button
There should also be an output text box for the answer.
The user should be allowed to enter a loan amount, an interest rate, and the number of years for the loan in the given text boxes, and when he clicks on the Compute Payment button, the payment should be displayed with a dollar sign and rounded to two decimal places.
Make the following assumptions:
1. Years is always an integer
2. Interest rate is always given as a percent. That is, 5.25% will be entered as 5.25, not .0525.
3. We are computing the monthly payment.
Find the formula for computing the payment on a loan on the internet. I have one such problem memorized (and you can use this to verify if you have implemented the formula correctly): If you borrow 50,000 for 30 years at 12% interest, your payments are $514.31.
When the user clicks on the Clear button, clear the loan amount and the interest rate, but put the value 30 in the years text box.
Use enough CSS to make your web page look nice.
Put the HTML page only into the drop box.