Java Reference
In-Depth Information
21 customerNumber =
-1
;
22 currentAccount =
null
;
23 state = START;
24 }
25
26 /**
27
Sets the current customer number
28
and sets state to PIN.
29
(Precondition: state is START)
30 @param number
the customer number
31 */
32
public void
setCustomerNumber(
int
number)
33 {
34 assert state == START;
35 customerNumber = number;
36 state = PIN;
37 }
38
39 /**
40
Finds customer in bank.
41
If found, sets state to ACCOUNT, else to START.
42
(Precondition: state is PIN)
43 @param pin
the PIN of the current customer
44 */
45
public void
selectCustomer(
int
pin)
46 {
47 assert state == PIN;
48 currentCustomer =
theBank.findCustomer(customerNumber, pin);
49
if
(currentCustomer ==
null
)
50 state = START;
51
else
52 state = ACCOUNT;
53 }
54
55 /**
56
Sets current account to checking or savings. Sets
57
state to TRANSACT.
58
(Precondition: state is ACCOUNT or TRANSACT)
59 @param account
one of CHECKING or SAVINGS
60 */