Write an HTML form that prompts the user to enter loan amount, interest rate, and number of years, as shown in Figure 1. Clicking the Compute Payment button invokes a JSP program to compute and display the monthly and total loan payments, as shown in Figure 2. Use the Loan class (Loan.java) provided in folder Lab3 on Blackboard to compute the monthly and total payments.

To create an HTML form that prompts the user to enter loan amount, interest rate, and number of years, and invokes a JSP program to compute and display the monthly and total loan payments, you can follow these steps:

1. Create an HTML file, for example, `loan_form.html`, and open it in your preferred text editor.

2. Add the HTML code to define a form element:
```
<!DOCTYPE html>
<html>
<head>
<title>Loan Calculator</title>
</head>
<body>
<h1>Loan Calculator</h1>
<form action="loan_payment.jsp" method="post">
<!-- form elements will be added here -->
</form>
</body>
</html>
```

3. Inside the form element, add the following inputs - one for loan amount, one for interest rate, and one for the number of years:
```
<label for="loanAmount">Loan Amount:</label>
<input type="number" id="loanAmount" name="loanAmount" required>

<label for="interestRate">Interest Rate (%):</label>
<input type="number" id="interestRate" name="interestRate" required>

<label for="numYears">Number of Years:</label>
<input type="number" id="numYears" name="numYears" required>
```

4. Add a submit button to the form:
```
<button type="submit">Compute Payment</button>
```

5. Save the `loan_form.html` file.

6. Create a JSP file, for example, `loan_payment.jsp`, and open it in your text editor.

7. Inside the JSP file, retrieve the form data using JSP expression and import the `Loan` class from the `Loan.java` file. Then, calculate the monthly and total payments using the Loan class and display the results:
```jsp
<%@ page import="com.example.Loan" %>
<!DOCTYPE html>
<html>
<head>
<title>Loan Payment Results</title>
</head>
<body>
<h1>Loan Payment Results</h1>
<%-- Retrieve form data --%>
<%
double loanAmount = Double.parseDouble(request.getParameter("loanAmount"));
double interestRate = Double.parseDouble(request.getParameter("interestRate"));
int numYears = Integer.parseInt(request.getParameter("numYears"));

// Create a new Loan object
Loan loan = new Loan(loanAmount, interestRate, numYears);

// Calculate monthly and total payments
double monthlyPayment = loan.getMonthlyPayment();
double totalPayment = loan.getTotalPayment();
%>

<%-- Display the results --%>
<p>Monthly Payment: $<%= monthlyPayment %></p>
<p>Total Payment: $<%= totalPayment %></p>
</body>
</html>
```

8. Save the `loan_payment.jsp` file.

You now have an HTML form that prompts the user to enter loan amount, interest rate, and number of years, and an associated JSP program that computes and displays the monthly and total loan payments using the `Loan` class.