Loan Amortization Calculator with JSP as View/Controller
Objective:
Create a folder to store all of your files generated with this assignment. Name this folder based on your last name concatenated with the letters JSP.
What to do:
Write a Java Web application using a JSP and Java classes that will calculate an amortization table for a loan.
An amortization table shows the monthly payment, the amount paid to interest, the amount paid down on the balance, and the monthly final balance over the life of a loan. When completed your application should produce output with numbers like that shown in Figures 1 and 2. As you can see in Figure 1, these values are for a 30 year loan with a principle of $20,000 at 6% interest. Your application should work correctly for any reasonable values of loan properties.
Your version of this output should be sent to the browser as the response from a jsp file. In addition, your program should work for all possible input values.
Required Components:
Loan.java: This defines a loan object. The Loan object should have principal, monthly rate, and total term as fields. It should have at least two constructors, a getter/setter pair for each instance variable, and a method that allows one to get a monthly payment. Here the Total Term is the total number of months in the life of the loan and the Monthly Rate is in decimal format (for example 1% = 0.01). You can calculate a monthly payment for a loan using:
Monthly Payment = Principal * Monthly Rate / (1 - (1 + Monthly Rate) ^ -Total Term ))
Amortization.java: This component will provide the amortization table portion of the output shown in Figures 1 and 2 when the doAmortization method is called. The Amortization class will include a Loan object as an instance variable. It will also have at least two constructors, a getter/setter pair for the instance variable, and a doAmortization method that will return a String containing the html based amortization table.
Some other relationships that you will need to complete the view are:
monthly payment to interest = monthly interest rate * current balance
monthly payment to balance = monthly payment - monthly payment to interest
current balance (after payment) = current balance (before payment) - monthly payment to balance
index.jsp: an html form page that allows the user to enter the initial loan information. Use textboxes and buttons. When the form is submitted, the doAmortization.jsp will be called to create the loan amortization output. doAmortization.jsp: a jsp page that will:
1. Get the data from the request.
2. Create a Loan and an Amortization objects
3. Use the Loan and Amortization object to calculate the amortization table
4. Get values from Amortization object and incorporate it into the HTML for response to the client.