Java Reference
In-Depth Information
99 {
100 assert state == TRANSACT;
101
return
currentAccount.getBalance();
102 }
103
104 /**
105
Moves back to the previous state.
106 */
107
public void
back()
108 {
109
if
(state == TRANSACT)
110 state = ACCOUNT;
111
else if
(state == ACCOUNT)
112 state = PIN;
113
else if
(state == PIN)
114 state = START;
115 }
116
117 /**
118
Gets the current state of this ATM.
119 @return
the current state
120 */
121
public int
getState()
122 {
123
return
state;
124 }
125
126
private int
state;
127
private int
customerNumber;
128
private
Customer currentCustomer;
129
private
BankAccount currentAccount;
130
private
Bank theBank;
131
132
public static final int
START =
1
;
133
public static final int
PIN =
2
;
134
public static final int
ACCOUNT =
3
;
135
public static final int
TRANSACT =
4
;
136
137
public static final int
CHECKING =
1
;
138
public static final int
SAVINGS =
2
;
139 }
566
567