Click here to Skip to main content
15,881,844 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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.
Posted
Updated 13-Oct-13 10:32am
v2
Comments
Andreas Gieriet 13-Oct-13 13:09pm    
And what is the question? As lazy as you are, you deserve a bad grading.
You don't show any effort other than pasting the question.
Sorry.
Andi
cvogt61457 16-Oct-13 9:46am    
I guess we lost him.
Too bad.

1 solution

Wow, if we do your homework, will we get the grade?

In order to help you with your homework, you need to show that you have made at least some attempt to solve the problem yourself.

Show your work.

If you have a problem on a particular issue, then you can ask a question that topic.

However, we will not do your homework for you. This would cause some serious ethical issues since it will be your grade but will be someone else's work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900