Question: Mortgage Calculator Create a form that allows you to enter in interest rate, monthly payment, principal , and number of years. Your Java Servlet program
Mortgage Calculator
Create a form that allows you to enter in interest rate, monthly payment, principal , and number of years. Your Java Servlet program then generates a table containing a row of output for each month of a mortgage. Your table should show Month number, New Principal, Interest Paid during the month. If the load is paid off, your table needs to properly stop.
*********************************** Sample Output *********************************
Interest Calculations
Calculating for:
interest rate/year =6
starting principal=10000
payment/month =1000
months =60
| Month Number | Principal | Interest |
|---|---|---|
| 1 | 9050.00 | 50.00 |
| 2 | 8095.25 | 45.25 |
| 3 | 7135.73 | 40.48 |
| 4 | 6171.40 | 35.68 |
| 5 | 5202.26 | 30.86 |
| 6 | 4228.27 | 26.01 |
| 7 | 3249.41 | 21.14 |
| 8 | 2265.66 | 16.25 |
| 9 | 1276.99 | 11.33 |
| 10 | 283.37 | 6.38 |
Last Payment = 284.79 This includes interest:1.42 **************************************************************************************
HINTS:
Take a look at the "RadioActive" servlet example in the notes. This application is similar to this homework. You can ignore the bar image part ... it's not part of this homework.
You will want to have a loop for the number of 12 * (Number of years). On each iteration of the loop, you will want to calculate the interest paid which is:
interestPaid = (newPrincipal * interest)/(12*100)
The 12 is because of 12 months in a year. The 100 is due to the fact that interest rates (like 6) are computed as 0.06 in interest calculations.
newPrincipal = newPrincipal + interestPaid - monthlyPayment
To get rid of the large number of decimal places that show up when you print a double, there is a format method in the String class that can help. Consider the following code (similar to the printf stuff in System.out):
String sPrinciple = String.format("%.2f", principal);
in Java Servlet Please separate answers into distinct categories. Such as html page, java class code, then servlet code. Thank you in advance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
