Java Reference
In-Depth Information
61
public void
selectAccount(int account)
62 {
63 assert state == ACCOUNT || state ==
TRANSACT;
64
if
(account == CHECKING)
65 currentAccount =
currentCustomer.getCheckingAccount();
66
else
67 currentAccount =
currentCustomer.getSavingsAccount();
68 state = TRANSACT;
69 }
70
71 /**
72
Withdraws amount from current account.
73
(Precondition: state is TRANSACT)
74 @param value
the amount to withdraw
75 */
76
public void
withdraw(
double
value)
77 {
78 assert state == TRANSACT;
79 currentAccount.withdraw(value);
80 }
81
82 /**
83
Deposits amount to current account.
84
(Precondition: state is TRANSACT)
85 @param value
the amount to deposit
86 */
87
public void
deposit(
double
value)
88 {
89 assert state == TRANSACT;
90 currentAccount.deposit(value);
91 }
92
93 /**
94
Gets the balance of the current account.
95
(Precondition: state is TRANSACT)
96 @return
the balance
97 */
98
public double
getBalance()
565
566