Question: Write a Java program to create a Mortgage class. Write the driver class separate. Mortgage class has loan, rate, and term as private data members.

Write a Java program to create a Mortgage class. Write the driver class separate. Mortgage class has loan, rate, and term as private data members.

Write constructors, get and set methods, and write a method to calculate monthly payment, and another method to display the results.

Create objects to test your program. Get the loan, rate, and term from user and pass them to your constructor with three arguments. The user cannot enter any negative value for loan, rate, and term. The loan amount should be between 100, 000 and 2000,000 (Data Validation). Add version control and proper comments to your program.

Get the data from user using scanner class.

(Sample data) Calculate the monthly payment for the amount = $200,000, the term = 30 years, and the interest rate = 4.5%. Your monthly payment should be about $1013.37.

Insert comments in the program to document the program.

Here is the guide for the Mortgage Calculator program, you can use the following formula:

monthlyPayment =( principal * rate) / ( 1.0 Math.pow(rate + 1, -term));

In Java:

term = term *12;

rate = rate/1200.0;

monthlyPayment =( principal * rate) / ( 1.0 Math.pow(rate + 1, -term));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!