UNB/ CS/ David Bremner/ teaching/ java/ Bank.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Vector;

public class Bank
{  /**
      Constructs a bank with no customers.
   public Bank()
   {  customers = new Vector();
      Reads the customer numbers and pins 
      and initializes the bank accounts.
      @param filename the name of the customer file
   public void readCustomers(String filename) 
      throws IOException
   {  BufferedReader in = new BufferedReader
         (new FileReader(filename));
      boolean done = false;
      while (!done)
      {  String inputLine = in.readLine();
         if (inputLine == null) done = true; 
         {  StringTokenizer tokenizer 
               = new StringTokenizer(inputLine);
            int number 
               = Integer.parseInt(tokenizer.nextToken());
            int pin 
               = Integer.parseInt(tokenizer.nextToken());

            Customer c = new Customer(number, pin);
      Adds a customer to the bank.
      @param c the customer to add
   public void addCustomer(Customer c)
   {  customers.add(c);
      Finds a customer in the bank.
      @param aNumber a customer number
      @param aPin a personal identification number
      @return the matching customer, or null if no customer 
   public Customer findCustomer(int aNumber, int aPin)
   {  for (int i = 0; i < customers.size(); i++)
      {  Customer c = (Customer)customers.get(i);
         if (c.match(aNumber, aPin))
            return c;
      return null;

   private Vector customers;