Java Reference
In-Depth Information
gain access to the accounts. (In a real ATM, the customer number would be
recorded on the magnetic strip of the ATM card. In this simulation, the customer
will need to type it in.) With the ATM, customers can select an account (checking
or savings). The balance of the selected account is displayed. Then the customer
can deposit and withdraw money. This process is repeated until the customer
chooses to exit.
The details of the user interaction depend on the user interface that we choose for
the simulation. We will develop two separate interfaces: a graphical interface that
closely mimics an actual ATM (see Figure 9 ), and a text-based interface that allows
you to test the ATM and bank classes without being distracted by GUI
programming.
In the GUI interface, the ATM has a keypad to enter numbers, a display to show
messages, and a set of buttons, labeled A, B, and C, whose function depends on the
state of the machine.
556
557
Figure 9
Graphical User Interface for the Automatic Teller Machine
Specifically, the user interaction is as follows. When the ATM starts up, it expects a
user to enter a customer number. The display shows the following message:
Enter customer number
A = OK
Search WWH ::




Custom Search