Results 1 to 2 of 2
- 04-03-2009, 05:23 PM #1
Member
- Join Date
- Apr 2009
- Posts
- 17
- Rep Power
- 0
[SOLVED] indexing an element in an array help!
I seem to be getting an error on the line "result = ...." on both 'if' statements that says:Java Code:if(input.equals(choices[1])){ accountNum = JOptionPane.showInputDialog("What is your account number?"); result = getAccountIndex(accountNum, accountNumber[i]); makeDeposit(accountNumber[i],accountBalance[i], creditLimit[i]); } if(input.equals(choices[2])){ accountNum = JOptionPane.showInputDialog("What is your account number?"); result = getAccountIndex(accountNum, accountNumber[i]); makeWithdrawal(accountNumber[i],accountBalance[i], creditLimit[i]); }
Error: getAccountIndex(java.lang.String,java.lang.String[]) in A5Q1ummadhoa cannot be applied to (java.lang.String,java.lang.String)
I think I may be overthinking the situatuation.
Java Code:public static int getAccountIndex(String key, String accountNumber[]){ int result = -1; for(int i=0;i<accountNumber.length;i++){ if(key.equals(accountNumber[i])){ return i; } else System.out.println("Invalid account number."); } return result; }
- 04-03-2009, 06:21 PM #2
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
Similar Threads
-
How to add an integer to a array element and the store that backinto an array.
By Hannguoi in forum New To JavaReplies: 1Last Post: 03-31-2009, 06:40 AM -
adding list to an array element
By Preethi in forum New To JavaReplies: 5Last Post: 09-25-2008, 04:23 AM -
Lucene Re-Indexing
By connect2srinath in forum LuceneReplies: 1Last Post: 05-11-2008, 05:35 PM -
Unique element in an array
By revathi17 in forum New To JavaReplies: 2Last Post: 12-31-2007, 08:44 AM -
Max element in an Array
By mew in forum New To JavaReplies: 5Last Post: 12-03-2007, 05:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks