Write an HTML form that prompts the user to enter loan amount, interest rate, and number of years, as shown below. Clicking the Submit button invokes a servlet to compute and display the monthly and total loan payments, as shown below.
Use the following calculations to compute the monthly and total payments.
double monthlyInterestRate = annualInterestRate / 1200;
double monthlyPayment = loanAmount * monthlyInterestRate / (1
- (Math.pow(1 / (1 + monthlyInterestRate), numberOfYears * 12)));
double totalPayment = monthlyPayment * numberOfYears * 12;
Website output: see image.