All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class banking.Message
java.lang.Object
   |
   +----banking.Message
  -  public class Message
  -  extends Object
Representations of a message from the ATM to the bank.
  Messages to the bank use a fixed format with fixed slots, not all of which
  pertain to any given type of transaction.  Each type of transaction creates
  one or more subclasses using the slots that it needs, and supplying appropriate
  "not needed" values for the rest.
   
  -   amount amount
-  Transaction amount specified by customer - if needed (else $0.00)
  
-   card card
-  The customer's card
  
-   COMPLETE_DEPOSIT COMPLETE_DEPOSIT
-  messageCode value for a message completing a deposit (envelope received).
  
-   fromAccount fromAccount
-  "From" account specified by customer - if needed (else - 1)
  
-   INITIATE_DEPOSIT INITIATE_DEPOSIT
-  messageCode value for a message initiating a deposit
  
-   INQUIRY INQUIRY
-  messageCode value for an inquiry message
  
-   messageCode messageCode
-  Code identifying the type of message - one of the above values
  
-   pin pin
-  PIN entered by customer
  
-   serialNumber serialNumber
-  Serial number of the transaction
  
-   toAccount toAccount
-  "To" account specified by customer - if needed (else - 1)
  
-   TRANSFER TRANSFER
-  messageCode value for a transfer between accounts message
  
-   WITHDRAWAL WITHDRAWAL
-  messageCode value for a cash withdrawal message
   
  -   Message(int, Card, int, int, int, int, Money) Message(int, Card, int, int, int, int, Money)
-  Constructor
  
   
  -   getAmount() getAmount()
-  Accessor for acmount
  
  
-   getCard() getCard()
-  Accessor for customer's card
  
  
-   getFromAccount() getFromAccount()
-  Accessor for "from" account
  
  
-   getMessageCode() getMessageCode()
-  Accessor for message code
  
  
-   getPIN() getPIN()
-  Accessor for PIN
  
  
-   getSerialNumber() getSerialNumber()
-  Accessor for transaction serial number
  
  
-   getToAccount() getToAccount()
-  Accessor for "to" account
  
  
-   setPIN(int) setPIN(int)
-  Set PIN to a new value (if original pin was invalid and customer is
  asked to re-enter PIN)
  
  
-   toString() toString()
-  Create a printable string representing this message
  
   
 WITHDRAWAL
WITHDRAWAL
 public static final int WITHDRAWAL
  -  messageCode value for a cash withdrawal message
 
 INITIATE_DEPOSIT
INITIATE_DEPOSIT
 public static final int INITIATE_DEPOSIT
  -  messageCode value for a message initiating a deposit
 
 COMPLETE_DEPOSIT
COMPLETE_DEPOSIT
 public static final int COMPLETE_DEPOSIT
  -  messageCode value for a message completing a deposit (envelope received).
 
 TRANSFER
TRANSFER
 public static final int TRANSFER
  -  messageCode value for a transfer between accounts message
 
 INQUIRY
INQUIRY
 public static final int INQUIRY
  -  messageCode value for an inquiry message
 
 messageCode
messageCode
 private int messageCode
  -  Code identifying the type of message - one of the above values
 
 card
card
 private Card card
  -  The customer's card
 
 pin
pin
 private int pin
  -  PIN entered by customer
 
 serialNumber
serialNumber
 private int serialNumber
  -  Serial number of the transaction
 
 fromAccount
fromAccount
 private int fromAccount
  -  "From" account specified by customer - if needed (else - 1)
 
 toAccount
toAccount
 private int toAccount
  -  "To" account specified by customer - if needed (else - 1)
 
 amount
amount
 private Money amount
  -  Transaction amount specified by customer - if needed (else $0.00)
 
   
 Message
Message
 public Message(int messageCode,
                Card card,
                int pin,
                int serialNumber,
                int fromAccount,
                int toAccount,
                Money amount)
  -  Constructor
   
- 
    -  Parameters:
    
-  messageCode - identifying the type of message
    -  card - the customer's card
    -  pin - the PIN entered by the customer
    -  serialNumber - serial number of the transaction
    -  fromAccount - the type of the "from" account of the transaction - can
         be -1 if the particular type of transaction does not have a "from"
         account (e.g. a deposit)
    -  toAccount - the type of the "to" account of the transaction - can
         be -1 if the particular type of transaction does not have a "to"
         account (e.g. a withdrawal)
    -  amount - the amount of the transaction - can be null if the particular
         type of transaction does not have an amount (e.g. an inquiry)
  
 
   
 toString
toString
 public String toString()
  -  Create a printable string representing this message
   
- 
    -  Returns:
    
-  string representation
    
-  Overrides:
    
-  toString in class Object
  
 
 setPIN
setPIN
 public void setPIN(int pin)
  -  Set PIN to a new value (if original pin was invalid and customer is
  asked to re-enter PIN)
   
- 
    -  Parameters:
    
-  pin - the new pin to set
  
 
 getMessageCode
getMessageCode
 public int getMessageCode()
  -  Accessor for message code
   
- 
    -  Returns:
    
-  the code identifying the type of message
  
 
 getCard
getCard
 public Card getCard()
  -  Accessor for customer's card
   
- 
    -  Returns:
    
-  the customer's card
  
 
 getPIN
getPIN
 public int getPIN()
  -  Accessor for PIN
   
- 
    -  Returns:
    
-  the PIN entered by the customer
  
 
 getSerialNumber
getSerialNumber
 public int getSerialNumber()
  -  Accessor for transaction serial number
   
- 
    -  Returns:
    
-  the serial number of the transaction
  
 
 getFromAccount
getFromAccount
 public int getFromAccount()
  -  Accessor for "from" account
   
- 
    -  Returns:
    
-  the type of the "from" account
  
 
 getToAccount
getToAccount
 public int getToAccount()
  -  Accessor for "to" account
   
- 
    -  Returns:
    
-  the type of the "to" account
  
 
 getAmount
getAmount
 public Money getAmount()
  -  Accessor for acmount
   
- 
    -  Returns:
    
-  the transaction amount
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index