Answered step by step
Verified Expert Solution
Question
1 Approved Answer
7. Congratulations! You just bought a house for X dollars, You have made a down payment of Y dollars, and have taken mortgage Mfrom a
7. Congratulations! You just bought a house for X dollars, You have made a down payment of Y dollars, and have taken mortgage Mfrom a bank to pay for the remaining amount, in monthly payments of N dollars, at an annual interest rate of P% (per year). Write a program Mortgage. java that calculates for each year the interest due to the unpaid balance; then calculates the new balance by adding the interest and subtracting the payment, until no more payments are required. The number of months T required to pay back the loan is obtained using the following formula (known as the NPER formula) -log (1- log (i 1) where p is the monthly interest rate (i.e., annual rate 12) The input must be stored in the input file mortgage.txt as follows: HousePrice DownPayment Annuallnterest Monthly Payment You must properly format your output as shown in the sample run below. Here, you may assume one tab between Month and Balance, and two tabs between Balance and Total Payments; also, the month requires 7 spaces left-aligned; the balance 15 spaces left-aligned; and aligned. the payments 9 spaces left For example, for a mortgage of $1000, a down payment of $500, interest rate of 5%, and monthly payment of $100, the program's output will be as follows: Month Balance 500.00 402.08 303.76 205.02 105.88 6.32 93.65 Total Payments 500.0 600.0 700.0 800.0 900.0 1000.0 1100.0 1 4 6 7. Congratulations! You just bought a house for X dollars, You have made a down payment of Y dollars, and have taken mortgage Mfrom a bank to pay for the remaining amount, in monthly payments of N dollars, at an annual interest rate of P% (per year). Write a program Mortgage. java that calculates for each year the interest due to the unpaid balance; then calculates the new balance by adding the interest and subtracting the payment, until no more payments are required. The number of months T required to pay back the loan is obtained using the following formula (known as the NPER formula) -log (1- log (i 1) where p is the monthly interest rate (i.e., annual rate 12) The input must be stored in the input file mortgage.txt as follows: HousePrice DownPayment Annuallnterest Monthly Payment You must properly format your output as shown in the sample run below. Here, you may assume one tab between Month and Balance, and two tabs between Balance and Total Payments; also, the month requires 7 spaces left-aligned; the balance 15 spaces left-aligned; and aligned. the payments 9 spaces left For example, for a mortgage of $1000, a down payment of $500, interest rate of 5%, and monthly payment of $100, the program's output will be as follows: Month Balance 500.00 402.08 303.76 205.02 105.88 6.32 93.65 Total Payments 500.0 600.0 700.0 800.0 900.0 1000.0 1100.0 1 4 6
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