Question

Mr. Mike wants to calculate a monthly mortgage payment. Assume that the interest rate is compounded...

Mr. Mike wants to calculate a monthly mortgage payment. Assume that the interest rate is compounded monthly.
Prompt the user for a double representing the annual interest rate.
Prompt the user for the number of years the mortgage will be held. ( typical input here is 10,15 or 30)
Prompt the user for a number representing the mortgage amount borrowed from the bank.
Write a Java Program that calculates the monthly mortgage payment.
Output the summary of the mortgage problem as follows
The annual interest rate in percent notation.
The mortgage amount in Omani Rials.
The monthly payment in Omani Rials with only to significant digits after the decimal point.
The total payment over the years with only two significant digits after the decimal point.
The overpayment, i.e., the difference between the total payment over the years and the mortgage amount.

Homework Answers

Answer #1

Explanation:I have written the code for calculating the mortgage payment in the class MortgagePayment and have also shown the output, please find the image attached with the answer.Please upvote if you liked my answer and comment if you need any modification or explanation.

//code

import java.util.Scanner;

public class MortgagePayment {

   public static void main(String[] args) {
       Scanner input = new Scanner(System.in);
       System.out.print("Enter the annual interest rate:");
       double interestRate = input.nextDouble();
       System.out.print("Enter number of years the mortgage will be held:");
       int noOfYears = input.nextInt();
       System.out.print("Enter the mortgage amount borrowed from the bank:");
       double mortgageAmount = input.nextDouble();
       double monthlyInterestRate = (interestRate / 100) / 12;
       int numberOfPayements = 12 * noOfYears;
       // formula for monthly mortgage payment M = P [ i(1 + i)^n ] / [ (1 +
       // i)^n – 1]
       double monthlyPayment = ((mortgageAmount) * (monthlyInterestRate
               * (Math.pow((1 + monthlyInterestRate), numberOfPayements))))
               / ((Math.pow((1 + monthlyInterestRate), numberOfPayements)
                       - 1));
       System.out
               .println("The annual interest rate is: " + interestRate + "%");
       System.out
               .println("The mortgage amount is: " + mortgageAmount + " OMR");
       System.out.println("The monthly payment is: "
               + Math.round(monthlyPayment * 100.0) / 100.0 + " OMR");
       double totalPayment = monthlyPayment * numberOfPayements;
       System.out.println("The total payment is: "
               + Math.round(totalPayment * 100.0) / 100.0 + " OMR");
       double overPayment = totalPayment - mortgageAmount;
       System.out.println("The over payment is: "
               + Math.round(overPayment * 100.0) / 100.0 + " OMR");

       input.close();

   }

}

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What is the monthly payment on a mortgage of $75000 with a 6.2% interest rate that...
What is the monthly payment on a mortgage of $75000 with a 6.2% interest rate that runs 30 years? How much interest is paid over the 30 years?
1) Consider a $126,714 35-year mortgage with an interest rate of 8% compounded monthly. a) Calculate...
1) Consider a $126,714 35-year mortgage with an interest rate of 8% compounded monthly. a) Calculate the monthly payment. b) How much of the principal is paid the first, 25th, and last year? c) How much interest is paid the first, 25th, and last year? d) What is the total amount of money paid during the 35 years? e)What is the total amount of interest paid during the 35 years? f) What is the unpaid balance after 25 years? g)How...
Using the Mortgage Payment Formula, calculate a monthly mortgage payment for a home with the price...
Using the Mortgage Payment Formula, calculate a monthly mortgage payment for a home with the price of $405,000 using pencil and paper. Your down payment is 10% of your own money apart from the loan. Calculate the total paid for your home after paying the monthly payment for 30 years factoring in the rate of 2.990%. You can use arithmetic. How much money will you pay in interest over 30 years? All Calculations must be shown.
Using the Mortgage Payment Formula, calculate a monthly mortgage payment for a home with the price...
Using the Mortgage Payment Formula, calculate a monthly mortgage payment for a home with the price of $405,000 using pencil and paper. Your down payment is 10% of your own money apart from the loan. Calculate the total paid for your home after paying the monthly payment for 15 years factoring in the rate of 2.500% and APR of 2.556%. You can use arithmetic. How much money will you pay in interest over 15 years? All Calculations must be shown.
Mr. Homemaker has just taken out a $175,000 mortgage at an interest rate of 3.6% [Annual...
Mr. Homemaker has just taken out a $175,000 mortgage at an interest rate of 3.6% [Annual rate]. The mortgage calls for equal monthly payments for 15 years. Then the amount of the monthly payment is:[Assume monthly compounding]
Consider a 30-year mortgage with an interest rate of 10% compounded monthly and a monthly payment...
Consider a 30-year mortgage with an interest rate of 10% compounded monthly and a monthly payment of $850. Cannot use excel must be equation based . If principal is 96,858.20 than....How much of the principal is paid the first, 5th, 20th and last year
Consider a 30-year mortgage at an interest rate of 8% compounded monthly with a $1200 monthly...
Consider a 30-year mortgage at an interest rate of 8% compounded monthly with a $1200 monthly payment. What is the total amount paid in interest? a. $236,403.75 b. $249,448.74 c. $268,459.81 d. $289,450.19
A 25 year mortgage at 4.5% interest compounded monthly with a monthly payment of $258.96 has...
A 25 year mortgage at 4.5% interest compounded monthly with a monthly payment of $258.96 has an unpaid balance of $5,000 after 280 months. Find the unpaid balance after 281 months.
1. Calculate the monthly payment for a 30-year fixed rate mortgage of $500,000 with 6% mortgage...
1. Calculate the monthly payment for a 30-year fixed rate mortgage of $500,000 with 6% mortgage rate and a balloon payment of $300,000 at maturity. 2. Assume we have a $2 million 10 year mortgage with annual payments beginning in exactly one year; the interest rate is 8%. Determine the annual mortgage payment under the following assumptions. In each case verify your calculation by giving the relation between the pay rate and the accrual rate. A) Loan is fully amortizing...
An $600,000 Mortgage is amortized by monthly payments over 25 years. The interest rate charged is...
An $600,000 Mortgage is amortized by monthly payments over 25 years. The interest rate charged is 4% compounded semi-annually. 1.What is the size of the monthly payment to the nearest dollars? 2.How much interest paid in the first payment? 3.What is the outstanding balance after the first payment?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT