previous | start

File Customer.java

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

 

 



previous | start