See more:
(untagged)
Write a program that will compute a monthly mortgage payment. A monthly mortgage payment is the same as a monthly loan payment. Normally, real estate loans are called mortgage loans. In this case you know the amount of the loan, called the principal, the annual interest paid, and the length of time to pay back the loan. The program needs to take that information and compute the monthly payment. Use the information and the provided formula below:
The letters in the formula below represent the following values:
P - - Principal amount borrowed, or loan amount
R - - Rate of interest computed for each month
N - - Number of months to pay back the loan or mortgage
Monthly Payment=[(R*(1+R)^N)/((1+R)^N-1 )] *P
TextLab03 Student Version Do not copy this file, which is provided.
// TextLab03st.java
// The Mortage Payment Program
// This the student, starting version of the TextLab03 assignment.
public class TextLab03st
{
public static void main(String args[])
{
System.out.println("TextLab03, Student Version\n");
double principal = 259000;
double annualRate = 5.75;
double numYears = 30;
System.out.println();
}
}
Important Note
Since you have not learned program input yet, the values of the principal, the annual rate of interest and the numbers of years to pay back the loan are hard coded in the provided program… however the formula requires the number of months to pay back the loan, not the number of years. There are also two issues with the interest. The number is written as 5.75, but 5.75% = 0.0575. On top of that you are provided with annual interest, but the formula requires monthly interest. In all of these cases, you need to make the program do the necessary conversions so the formula will work.
Hard Coding Warning
The only things hard coded in this program are the principal, the annual rate of interest and the numbers of years to pay back the loan. Everything else must be computed by the program. For example, a command like numMonths = 360; or worse monthlyPayment = 1511.45 will cause you to earn a 0 on this lab. The program must do its own calculations.
80 Point Version
The 80 point version only computes the monthly mortgage payment.