1. Member
Join Date
Dec 2011
Posts
15
Rep Power
0

Hi I am in a beginning Java class and have to come up with my assignment. It is hard for me to understand how this works through reading and learning on my own through a book. But here is what I am required to do. Write the program in Java (without a graphical user interface) using a loan amount of \$200,000 with an interest rate of 5.75% and a 30 year term. Display the mortgage payment amount and then list the loan balance and interest paid for each payment over the term of the loan. If the list would scroll off the screen, use loops to display a partial list, hesitate, and then display more of the list..... I understand that you will probably not just give me the answer but I have no clue where to go with this or where to look in my book to continue on. This is all I have so far. ( I am using NetBeans)

public class MortgageCalculator {

public static void main(String[] args) {
double annualInterest = 5.75; //This is the annual interest rate
double loanAmount = 200000; //This is the loan amount
double loanLengthInYears = 30; //This is the length of the loan in years

//Formuals bieng used are:
double monthlyInterest = annualInterest /100/12;
double loanLengthInMonths = loanLengthInYears * 12;

double monthlyPayment = (loanAmount * monthlyInterest) / (1 - Math.pow((1 + monthlyInterest), -loanLengthInMonths));
DecimalFormat decimalPlaces=new DecimalFormat("0.00");//Rounds up the dollar amount

System.out.println("MortgageCalculator");
System.out.println("Annual Interest: 5.75%");
System.out.println("Loan Amount: \$200,000");
System.out.println("Loan Length: 30 years");
System.out.println("Monthly Payment: " + decimalPlaces.format(monthlyPayment));
}
}

2. Member
Join Date
Jan 2012
Posts
9
Rep Power
0

I recommend this video to introduce you to loops.

You need to define an number of entries to be entered on one line, say 5 entries per line, and call system.out.println() when you reach five numbers for example.

3. ## Re: Need direction please

Which part is giving you problems?
Break the task up into small steps and do them one at a time.
Do a design, enter the code, compile and test for each step. When a step works, move to the next one.

4. Member
Join Date
Feb 2010
Posts
80
Rep Power
0

dude, all you have are declarations and printing.

Norm's right, you have to break the code into smaller steps.

try solving the problem in a piece of paper, then create the algorithm and write it in plain english. then try to translate that into code using pseudo-code. we'd at least be more willing to help you then.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•