All pastes #438136 Raw Edit

Mine

public java v1 · immutable
·published 2007-04-13 13:25 UTC
rendered paste body
import java.util.List;import java.util.ArrayList;import java.util.Iterator;public class Bank{    List advisorList;    List bankAccountList;        public Bank()    {       this.advisorList = new ArrayList();       this.bankAccountList = new ArrayList();           }        public static Bank getInstance()    {    	return new Bank();    }        //* return an account by it's account number    public BankAccount getAccountByNumber(int accountNum)    {        for(int i=0; i< this.bankAccountList.size(); i++)        {               BankAccount check = (BankAccount) this.bankAccountList.get(i) ;               if(check.getAccountNumber() == accountNum)               {                   return check;               }        }        return null;    }        //* Given a customers last name return the account number    public BankAccount getAccountByName(String lastName)    {        Iterator itName = this.bankAccountList.iterator();        while (itName.hasNext())        {                        Customer c = (Customer)itName.next();            Iterator itLastName = (c.getLastName()).iterator();            while(itLastname.hasNext())            {               Customer c = (Customer)itLastName.next();               if(c.getLastName().equals(lastName))               {                return c;               }            }            return null;        }        /*for(int i=0; i< this.bankAccountList.size(); i++)        {               BankAccount check = (BankAccount) this.bankAccountList.get(i);               List clients = check.getCustomerList();               for(Object o : clients)               {               		Customer c = (Customer) o;               		               		if(c.getLastName().equals(lastName))               		{               		    return check;             		}               }        }        return null;        */    }        //* deposit money into a BankAccount    public void deposit(BankAccount b, double amt)    {    	b.deposit(amt);    }        public void withdraw(BankAccount b, double amt)    {    	b.withdraw(amt);    }        //Print all advisors in the advisorList    public List showAdvisor()    {    	Iterator itAdvisor = advisorList.iterator();        while (itAdvisor.hasNext())        {            Advisor a = (Advisor)itAdvisor.next();            System.out.println("======================");            System.out.println(a);            System.out.println("======================");        }              return null;    }        public void addAdvisor(Advisor advisor)    {    	advisorList.add(advisor);    }        public void addBankAccount(BankAccount b)    {    	bankAccountList.add(b);    	    }   }