| | |
Array issue
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Feb 2006
Posts: 6
Reputation:
Solved Threads: 0
Error
.java:132: incompatible types
found : int
required: int[]
int[] months= numOfYears[i]*12; //The variable used for user input for exact month information
^
1 error
Tool completed with exit code 1
.java:132: incompatible types
found : int
required: int[]
int[] months= numOfYears[i]*12; //The variable used for user input for exact month information
^
1 error
Tool completed with exit code 1
Java Syntax (Toggle Plain Text)
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
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
This isn't an array:
Shouldn't it be:
int[] months= numOfYears[i*12];
Java Syntax (Toggle Plain Text)
int[] months= numOfYears[i]*12; //The variable used for user input for exact month information
Shouldn't it be:
int[] months= numOfYears[i*12];
![]() |
Similar Threads
- Summing Issue from Array (Java)
- Narue's Heap sort a further explanation? (C)
- Contaminating signals for testing filters on MATLAB (Computer Science)
- declaration of array issue (C)
Other Threads in the Java Forum
- Previous Thread: Applet / Array help
- Next Thread: Error while compiling but not in the code itself????
| Thread Tools | Search this Thread |
Tag cloud for Java
affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth businessintelligence chat class classes client code component database desktop draw ebook eclipse encode equation error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer intersect j2me java javaexcel javaprojects jmf jni jpanel julia linked linux list loop mac main map method methods mobile netbeans newbie number online open-source oracle parameter print problem program programming project properties recursion reference replaysolutions rotatetext scanner score screen scrollbar server set size sms socket sort sql string superclass swing template test threads time tree windows working xstream






