
import java.util.*;

/**
 * Representation for a customer of the bank
 * 
 * @author Russell C. Bjork
 * @version January 9, 2003
 */

public class Customer
{
    private String name;
    private List accounts = new ArrayList();

    /**
     * Constructor for objects of class Customer
     * 
     * @param name the customer's name
     */
    public Customer(String name)
    {
        this.name = name;
    }
    
    /**
     * Add an account to list of accounts owned by customer
     * 
     * @param account the account to be added
     */
    public void addAccount(SavingsAccount account)
    {
        accounts.add(account);
    }
    
    /**
     * Print out information on all accounts owned by customer
     */
    public void printAccounts()
    {
        System.out.println("Account information for: " + name);
        Iterator iterator = accounts.iterator();
        while (iterator.hasNext())
        {
            SavingsAccount account = (SavingsAccount) iterator.next();
            System.out.println("Account " + account.getAccountNumber() + " " + 
                account.reportBalance());
        }
        System.out.println("End of information for: " + name);
        System.out.println();
    }
}
