• 01-05-2012, 06:51 AM
kprofgold
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));
}
}
• 01-05-2012, 11:21 AM
bayan.rafeh
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.
• 01-05-2012, 01:40 PM
Norm