1 /**
2 A bank customer with a checking and a savings account.
3 */
4 public class Customer
5 {
6 private int customerNumber;
7 private int pin;
8 private BankAccount checkingAccount;
9 private BankAccount savingsAccount;
10
11 /**
12 Constructs a customer with a given number and PIN.
13 @param aNumber the customer number
14 @param aPin the personal identification number
15 */
16 public Customer(int aNumber, int aPin)
17 {
18 customerNumber = aNumber;
19 pin = aPin;
20 checkingAccount = new BankAccount();
21 savingsAccount = new BankAccount();
22 }
23
24 /**
25 Tests if this customer matches a customer number
26 and PIN.
27 @param aNumber a customer number
28 @param aPin a personal identification number
29 @return true if the customer number and PIN match
30 */
31 public boolean match(int aNumber, int aPin)
32 {
33 return customerNumber == aNumber && pin == aPin;
34 }
35
36 /**
37 Gets the checking account of this customer.
38 @return the checking account
39 */
40 public BankAccount getCheckingAccount()
41 {
42 return checkingAccount;
43 }
44
45 /**
46 Gets the savings account of this customer.
47 @return the checking account
48 */
49 public BankAccount getSavingsAccount()
50 {
51 return savingsAccount;
52 }
53 }