i am doing a university assigment and im having some problems. Basically theres a series of linked lists in the setup of a bank account. i have to search for a sepcific account.
i have the basic set up okay, a for statement thats going through the accounts and compares the account number with the search string:
problem is temp.getelement() returns the full account where as i only need the account number.Code:/** * Search Accounts */ public static int seqSearch(CompNode L, Comparable target) { CompNode temp = L; boolean found = false; int position = 1; for (int i = 0; i<countList(L); i++) { if (target == temp.getElement()) { System.out.println ("ITEM FOUND"); found = true; return position; } else { System.out.println (temp.getElement()); temp = temp.getNext(); System.out.println ("ITEM NOT FOUND"); } } return position; }
Now i dont want someone to give me the code i need straight off, id never learn that waybut basically a point in the right direction or a sample bit of code
Thanks
nino




but basically a point in the right direction or a sample bit of code
Reply With Quote