# Arrays for mortgage calc

• January 21st, 2012, 09:32 PM
kprofgold
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]);

}

}
• January 21st, 2012, 11:14 PM
elisha.java
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.
• January 22nd, 2012, 12:01 AM
kprofgold
Re: Arrays for mortgage calc
Yes it is required by the instructor to use arrays.