Question
Please use java control flow statements. Write a program to determine the mortgage insurance, loan amount and mortgage payments for a person buying a house.
Please use java control flow statements.
Write a program to determine the mortgage insurance, loan amount and mortgage payments for a person buying a house. The program should ask the user for the following things: (1) Asking price for the house (2) Loan amortization period in years (3) Interest rate offered by the bank (4) Down payment available with the user (5) Mortgage payments monthly (M/m) or bi-weekly (B/b) The mortgage insurance interest rates for various down payment ranges are mentioned below along with the formulae required to compute mortgage insurance, loan amount and mortgage payments.
Here is the formula to calculate the Mortgage Insurance: Mortgage Insurance (MI) = (Asking Price - Down Payment)*Mortgage insurance interest For instance, if the asking price was 100,000$ and down payment was 10,000$, interest rate will be 3.10% and the mortgage insurance will be (100,000 10,000)*3.1 = 2,790$. The loan amount is then calculated as Loan Amount = Asking Price - Down Payment + Mortgage insurance = 90,000 + 2,790 = 92,790$. The mortgage payments depend on loan amount, loan amortization period, interest rate offered by the bank (not the mortgage insurance interest rate), and whether the payments are made monthly or bi-weekly. Mortgage payments = (1+) (1+)1 where, L is the loan amount, r is the monthly/bi-weekly interest rate (to be computed based on the yearly interest rate) and n is the number of payments.
For instance, the loan amount calculated above is considered for amortization period of 25 years with bank providing 3.66% interest rate and the payments are done monthly then the mortgage payments will be computed as follows. L = 92,790$ r = (3.66/100)/12 = 0.00305 n = 25 * 12 = 300 =92,7900.00305(1+0.00305)300(1+0.00305)3001 = 472.53183$ In case of a b-weekly payment mode, there are 52 weeks in a year making 26 payments per year and n will become 25 * 26 = 650 and r will become (3.66/100)/26 = 0.00141 =92,7900.00141(1+0.00141)650(1+0.00141)6501 = 217.97621$ You need to force the user to enter minimum 5% down payment and correct character for mode of mortgage payments (i.e. M/m or B/b) by the use of loop construct in Java.
Here are some sample output to illustrate how program should behave:
Mortgage Calculator --------------------------------------------------------- Please enter the asking price for the house: 100000 Please enter the loan amortization period in years: 25 Please enter the interest rate offered by the bank: 3.66 Please enter the down payment amount in dollars: 4500 Please enter the down payment amount in dollars: 10000 Please enter the mode of mortgage payments monthly (M/m) or bi-weekly (B/b): m Mortgage Result --------------- Your mortgage insurance will be $2790.0 Your total loan amount will be $92790.0 Your mortgage payments will be $472.53183 Mortgage Calculator --------------------------------------------------------- Please enter the asking price for the house: 100000 Please enter the loan amortization period in years: 25 Please enter the interest rate offered by the bank: 3.66 Please enter the down payment amount in dollars: 10000 Please enter the mode of mortgage payments monthly (M/m) or bi-weekly (B/b): V Please enter the mode of mortgage payments monthly (M/m) or bi-weekly (B/b): B Mortgage Result --------------- Your mortgage insurance will be $2790.0 Your total loan amount will be $92790.0 Your mortgage payments will be $217.97621
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