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

import java.util.*;

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

    /**
     * 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(BankAccount account)
    {
        accounts.add(account);
    }
    
    /**
     * Print out information on all accounts owned by customer
     */
    public void printAccounts()
    {
        System.out.println("Account information for: " + name);
        Iterator<BankAccount> iterator = accounts.iterator();
        while (iterator.hasNext())
        {
            BankAccount account = iterator.next();
            System.out.println("Account " + account.getAccountNumber() + " " + 
                account.reportBalance());
        }
        System.out.println("End of information for: " + name);
        System.out.println();
    }
}
