All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class atm.physical.CashDispenser
java.lang.Object
   |
   +----atm.physical.CashDispenser
  -  public class CashDispenser
  -  extends Object
Manager for the ATM's cash dispenser.  In a real ATM, this would 
  manage a physical device; in this simulation,  it uses classes 
  in package simulation to simulate the device.
   
  -   cashOnHand cashOnHand
-  Current cash on hand
  
-   log log
-  Log into which cash amounts dispensed will be recorded
   
  -   CashDispenser(Log) CashDispenser(Log)
-  Constructor
  
   
  -   checkCashOnHand(Money) checkCashOnHand(Money)
-  See if there is enough cash on hand to satisfy a request
  
  
-   dispenseCash(Money) dispenseCash(Money)
-  Dispense cash to a customer
  
  
-   setInitialCash(Money) setInitialCash(Money)
-  Set the amount of cash initially on hand 
  
   
 log
log
 private Log log
  -  Log into which cash amounts dispensed will be recorded
 
 cashOnHand
cashOnHand
 private Money cashOnHand
  -  Current cash on hand
 
   
 CashDispenser
CashDispenser
 public CashDispenser(Log log)
  -  Constructor
   
- 
    -  Parameters:
    
-  log - the log in which to record dispensing cash
  
 
   
 setInitialCash
setInitialCash
 public void setInitialCash(Money initialCash)
  -  Set the amount of cash initially on hand
   
- 
    -  Parameters:
    
-  initialCash - the amount of money in the dispenser
  
 
 checkCashOnHand
checkCashOnHand
 public boolean checkCashOnHand(Money amount)
  -  See if there is enough cash on hand to satisfy a request
   
- 
    -  Parameters:
    
-  amount - the amount of cash the customer wants
    
-  Returns:
    
-  true if at least this amount of money is available
  
 
 dispenseCash
dispenseCash
 public void dispenseCash(Money amount)
  -  Dispense cash to a customer
   
- 
    -  Parameters:
    
-  amount - the amount of cash to dispense
  Precondition: amount is <= cash on hand
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index