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.


Variable Index

 o amount
Transaction amount specified by customer - if needed (else $0.00)
 o card
The customer's card
 o COMPLETE_DEPOSIT
messageCode value for a message completing a deposit (envelope received).
 o fromAccount
"From" account specified by customer - if needed (else - 1)
 o INITIATE_DEPOSIT
messageCode value for a message initiating a deposit
 o INQUIRY
messageCode value for an inquiry message
 o messageCode
Code identifying the type of message - one of the above values
 o pin
PIN entered by customer
 o serialNumber
Serial number of the transaction
 o toAccount
"To" account specified by customer - if needed (else - 1)
 o TRANSFER
messageCode value for a transfer between accounts message
 o WITHDRAWAL
messageCode value for a cash withdrawal message

Constructor Index

 o Message(int, Card, int, int, int, int, Money)
Constructor

Method Index

 o getAmount()
Accessor for acmount
 o getCard()
Accessor for customer's card
 o getFromAccount()
Accessor for "from" account
 o getMessageCode()
Accessor for message code
 o getPIN()
Accessor for PIN
 o getSerialNumber()
Accessor for transaction serial number
 o getToAccount()
Accessor for "to" account
 o setPIN(int)
Set PIN to a new value (if original pin was invalid and customer is asked to re-enter PIN)
 o toString()
Create a printable string representing this message

Variables

 o WITHDRAWAL
 public static final int WITHDRAWAL
messageCode value for a cash withdrawal message

 o INITIATE_DEPOSIT
 public static final int INITIATE_DEPOSIT
messageCode value for a message initiating a deposit

 o COMPLETE_DEPOSIT
 public static final int COMPLETE_DEPOSIT
messageCode value for a message completing a deposit (envelope received).

 o TRANSFER
 public static final int TRANSFER
messageCode value for a transfer between accounts message

 o INQUIRY
 public static final int INQUIRY
messageCode value for an inquiry message

 o messageCode
 private int messageCode
Code identifying the type of message - one of the above values

 o card
 private Card card
The customer's card

 o pin
 private int pin
PIN entered by customer

 o serialNumber
 private int serialNumber
Serial number of the transaction

 o fromAccount
 private int fromAccount
"From" account specified by customer - if needed (else - 1)

 o toAccount
 private int toAccount
"To" account specified by customer - if needed (else - 1)

 o amount
 private Money amount
Transaction amount specified by customer - if needed (else $0.00)

Constructors

 o 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)

Methods

 o toString
 public String toString()
Create a printable string representing this message

Returns:
string representation
Overrides:
toString in class Object
 o 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
 o getMessageCode
 public int getMessageCode()
Accessor for message code

Returns:
the code identifying the type of message
 o getCard
 public Card getCard()
Accessor for customer's card

Returns:
the customer's card
 o getPIN
 public int getPIN()
Accessor for PIN

Returns:
the PIN entered by the customer
 o getSerialNumber
 public int getSerialNumber()
Accessor for transaction serial number

Returns:
the serial number of the transaction
 o getFromAccount
 public int getFromAccount()
Accessor for "from" account

Returns:
the type of the "from" account
 o getToAccount
 public int getToAccount()
Accessor for "to" account

Returns:
the type of the "to" account
 o getAmount
 public Money getAmount()
Accessor for acmount

Returns:
the transaction amount

All Packages  Class Hierarchy  This Package  Previous  Next  Index