0

Error
.java:132: incompatible types
found : int
required: int[]
int[] months= numOfYears*12; //The variable used for user input for exact month information
^
1 error

Tool completed with exit code 1

public void actionPerformed(ActionEvent Mortgage) {													// Starts Mortgage Calculator
        DecimalFormat decimalPlaces=new DecimalFormat("0.00");
        appMonthlyPayment.setText("");

        // The next 3 lines get the values from the text boxes. - The only user entry will be principal for this version
        // term = Integer.parseInt(appTerm.getText());
        // interest = Double.parseDouble(appTerm.getText());
        principal = Double.parseDouble(appPrincipal.getText());


        //Calculate Monthly Interest
        double monthlyInterest = annualInterests[i]/(12*100);
        int totalNumOfMonths = numOfYears[i]*12;

        int[] months= numOfYears[i]*12; 	   		         //The variable used for user input for exact month information
        monthlyInterest = interest/(12 * 100);   //calculate the monthly interst using simple interest.
        double denominator= Math.pow(1 + monthlyInterest, -(numOfYears[i]*12));
        denominator= 1 - denominator;
        double monthlyPayment= principal * (monthlyInterest/ denominator);
	}
        public double getMortgageAmount(double principal, double monthlyInterest, int numOfMonths){
        // Monthly payment formula: M = P x (J/(1-(1+J)^-N));
        // M = P * ( J / (1 - (1 + J) ** -N));
        // source: http://www.hughchou.org/calc/formula.html
        double monthlyPayment= (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));
        return monthlyPayment;

        double getMonthlyPrincipal, remainingPrincipal;		//calculate the monthly interst using simple interest.

        return monthlyPayment - (remainingPrincipal * monthlyInterest);

        appMonthlyPayment.setText("Payment = " + monthlyPayment);			 // Finally, set the text field to show the result
    }																		 // Ends Mortgage Calculator
2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by server_crash
0

This isn't an array:

int[] months= numOfYears[i]*12; //The variable used for user input for exact month information

Shouldn't it be:

int[] months= numOfYears[i*12];

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.