Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Arrays for mortgage calc

1. ## Arrays for mortgage calc

Hi can somebody please help me or give me some direction on how I am supposed to do this: Write the program in Java (without a graphical user interface) and have it calculate the payment amount for 3 mortgage loans:
* - 7 year at 5.35%
* - 15 year at 5.5%
* - 30 year at 5.75%
Use an array for the different loans. Display the mortgage payment amount for each loan.
I dont even know if I am even close with the arrays but I think I need to add formulas to this to. I just am completely lost. Here is what I have. (I know I am not even close) Please help!!

package mortgagecalculator2;

/**
*
* @author
*/
public class MortgageCalculator2 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double loanAmount[]=new double[1];
loanAmount[0]=200000.00;

double loanLengthInMonths[]=new double[3];
loanLengthInMonths[0]=84;
loanLengthInMonths[1]=180;
loanLengthInMonths[2]=360;

double monthlyInterest[]=new double[3];
monthlyInterest[0]=5.35;
monthlyInterest[1]=5.5;
monthlyInterest[2]=5.75;

System.out.println(loanAmount[0]);
System.out.println(loanLengthInMonths[0]);
System.out.println(monthlyInterest[0]);
System.out.println(loanAmount[0]);
System.out.println(loanLengthInMonths[1]);
System.out.println(monthlyInterest[1]);
System.out.println(loanAmount[0]);
System.out.println(loanLengthInMonths[2]);
System.out.println(monthlyInterest[2]);

}

}

2. ## Re: Arrays for mortgage calc

Do you need arrays to solve this problem at all? Looks like using simple math operations can give you what you need.

3. ## Re: Arrays for mortgage calc

Yes it is required by the instructor to use arrays.