Question
For this assignment we will use a simplified model of how mortgages work in the real world. When a borrower gets a mortgage, the lender
For this assignment we will use a simplified model of how mortgages work in the real world. When a borrower gets a mortgage, the lender provides an amount of money called the principal and the borrower commits to paying a fixed monthly amount that covers the interest on the principal and gradually pays the principal back. Every month part of the payment goes towards paying the interest on the remaining principal and the rest goes towards paying back part of the principal. Eventually the principal goes down to 0 and when that happens the mortgage terminates. The monthly payment must be larger than the monthly interest on the initial principal.
For a given interest rate, principal size and monthly payment, the client will want to find out how long it will take to pay off the mortgage and what will be the amount she will spend over the years on interest. The principal and the monthly payment are positive integers (measured in dollars) and the interest rate is a number that can contain a fractional part and it is expressed a percentage. The monthly interest rate is 1/12 times the interest rate entered by the user. Thus if the principal is $100,000, the interest rate 6%, and the monthly payment $2,000, the interest for the first month will be 0.5% $100,000 = $ 500 and so $500 of the first payment will go towards the principal and $1,500 towards reducing the principal (which will decrease to $98,500 after the first month). For this particular example the mortgage will be paid off after 4 years and 10 months and the total amount that goes towards paying the interest is $15,361.36
Design a Website or Page that uses JSP and Servlets to perform the following functionality.
The page should consist of two main regions: the narrower left-side region holding the actual calculator and the right-side region holding a log of previous calculations. The calculator should have three input fields (with appropriate labels) for the principal, interest rate and monthly payment, a submit button triggering the computation, a reset button for clearing all fields and two elements displaying the results of the calculation - the duration of the mortgage expressed as an integer number of years followed by between 0 and 11 months, and the total amount that goes toward paying the interest. The calculator should check the validity of the input parameters. After every computation, the log of calculations should be extended with a record holding the three input parameters and the two results. The log should have a button allowing the user to clear it. Each individual log record should also have some type of element allowing the user to delete it.
Furthermore, clicking on any of the three input parameters present in a log record should change the value of the corresponding field in the calculator to the value from the log entry. This last feature allows the user to perform new calculations by "mixing and matching" input parameters from previous calculations.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started