All Packages Class Hierarchy This Package Previous Next Index
Class atm.physical.CustomerConsole
java.lang.Object
|
+----atm.physical.CustomerConsole
- public class CustomerConsole
- extends Object
Manager for the ATM's customer console. In a real ATM, this would
manage a physical device; in this simulation, it uses classes
in package simulation to simulate the device (actually two separate
devices - the display and the keyboard.)
-
CustomerConsole()
- Constructor
-
display(String)
- Display a message to the customer
-
readAmount(String)
- Read a money amount entered by the customer
-
readMenuChoice(String, String[])
- Display a menu of options and return choice made by customer
-
readPIN(String)
- Read a PIN entered by the customer (echoed as asterisks)
CustomerConsole
public CustomerConsole()
- Constructor
display
public void display(String message)
- Display a message to the customer
- Parameters:
- message - the message to display
readPIN
public int readPIN(String prompt) throws CustomerConsole. Cancelled
- Read a PIN entered by the customer (echoed as asterisks)
- Parameters:
- prompt - the message to display prompting the customer to enter PIN
- Returns:
- the PIN that was entered
- Throws: CustomerConsole. Cancelled
- if customer presses the CANCEL key before pressing ENTER
readMenuChoice
public synchronized int readMenuChoice(String prompt,
String menu[]) throws CustomerConsole. Cancelled
- Display a menu of options and return choice made by customer
- Parameters:
- prompt - message to display before the list of options
- menu - the options
- Returns:
- the number of the option chosen (0 .. # of options - 1)
Note: the options are numbered 1 .. # of options when displayed for the
customer - but the menu array indices and the final result returned are in
the range 0 .. # of options - 1
- Throws: CustomerConsole. Cancelled
- if customer presses the CANCEL key before choosing option
readAmount
public synchronized Money readAmount(String prompt) throws CustomerConsole. Cancelled
- Read a money amount entered by the customer
- Parameters:
- prompt - the message to display prompting the customer to enter amount
- Returns:
- the amount entered by the customer
- Throws: CustomerConsole. Cancelled
- if customer presses the CANCEL key before pressing ENTER
All Packages Class Hierarchy This Package Previous Next Index