View Single Post
  #19 (permalink)  
Old 09-14-2008, 08:13 AM
CirKuT CirKuT is offline
Member
 
Join Date: Sep 2008
Posts: 49
CirKuT is on a distinguished road
OK I will try your code,

I do think I go tit working with this, Im not 100% sure but I am getting no errors let me know what you think,

In the begining the getAcount method looked like this,

public coldbeveragejava.Account getAcount(int accountID) {
return null;
}

I needed to change it so it took the accountID and checked it against the accounts that already existed, Note that a user can only enter a 1 or a 2 and both these accountID's already exist in the array,
Here is what I modified the code to

public coldbeveragejava.Account getAcount(int accountID) {

// loop through accounts searching for matching account number
for ( Account currentAccountID : accounts )
{
// return current account if match found
if ( currentAccountID.getAccountNumber() == accountID )
return currentAccountID;
}
return null;
}

Its getting no errors and it seems to work.
Reply With Quote