[ Intro ]
   [ Requirements ]
   [ Domain Objects ]
   [ Use Cases ]
   [ CRC Cards ]
   [ Class Diagram ]
   
   [ Class Description Forms ]
   [ Operation Description Forms ]
   [ Code ]
   [ Executable ]
| ATM:: | ATM | 
|---|---|
| Prototype | ATM(int number, const char * location) | 
| Purpose | Constructor | 
| Receives | number - the ATM's number | 
| location - the ATM's location | |
| Returns | |
| Remarks | 
| ATM:: | startupOperation | 
|---|---|
| Prototype | Money startupOperation() | 
| Purpose | Perform startup tasks when the ATM's switch is turned on | 
| Receives | |
| Returns | Initial cash in the cash dispenser | 
| Remarks | Waits for operator to turn switch on. Sets _state to RUNNING. Asks operator how much cash is in the dispenser.  | 
| ATM:: | serviceCustomers | 
|---|---|
| Prototype | void serviceCustomers(Money initialCash) | 
| Purpose | Run the ATM until the switch is turned off | 
| Receives | initialCash - amount of money in cash dispenser to start | 
| Returns | |
| Remarks | Creates a new Session when a readable card is inserted. Polls operator switch when no session is active, sets _state to STOPPED and exits when switch is turned off.  | 
| ATM:: | getPIN | 
|---|---|
| Prototype | int getPIN() const | 
| Purpose | Get personal identification number (PIN) from customer | 
| Receives | |
| Returns | PIN entered by customer | 
| Remarks | Displays request on screen, then reads PIN from keyboard. PIN digits are echoed as asterisks to preserve secrecy.  | 
| ATM:: | getTransactionChoice | 
|---|---|
| Prototype | Transaction::TransactionType getTransactionChoice() const | 
| Purpose | Get choice of transaction type from customer | 
| Receives | |
| Returns | Customer choice from list of options | 
| Remarks | Displays list of choices, then requests customer to choose one using keyboard.  | 
| ATM:: | getDoAnotherTransactionChoice | 
|---|---|
| Prototype | bool getDoAnotherTransactionChoice() const | 
| Purpose | Ask customer if he/she wants to do another transaction | 
| Receives | |
| Returns | True iff customer chooses yes | 
| Remarks | Displays question, then asks customer to choose yes or no using keyboard.  | 
| ATM:: | getAccountChoice | 
|---|---|
| Prototype | Bank::AccountType getAccountChoice(const char * purpose) const | 
| Purpose | Ask customer to choose an account for a specified purpose (e.g. withdraw from, transfer to, etc.) | 
| Receives | purpose - brief description of what the account chosen is to be used for | 
| Returns | Customer choice from a list of options | 
| Remarks | Displays purpose and list of choices, then asks customer to choose one using keyboard | 
| ATM:: | getWithdrawlAmountChoice | 
|---|---|
| Prototype | Money getWithdrawlAmountChoice() const | 
| Purpose | Ask customer to choose amount for a cash withdrawl. | 
| Receives | |
| Returns | Customer choice from a list of options. | 
| Remarks | Displays a list of possible amounts and asks customer to choose one using keyboard. | 
| ATM:: | getAmountEntry | 
|---|---|
| Prototype | Money getAmountEntry() const | 
| Purpose | Ask customer to enter an amount of money for a deposit, etc. | 
| Receives | |
| Returns | Amount of money customer entered. | 
| Remarks | Asks user to enter amount, then reads amount typed at keyboard. | 
| ATM:: | checkIfCashAvailable | 
|---|---|
| Prototype | bool checkIfCashAvailable(Money amount) const | 
| Purpose | Determine if cash dispenser has enough cash left to satisfy a withdrawl request  | 
| Receives | amount - amount desired | 
| Returns | True iff requested amount is available. | 
| Remarks | 
| ATM:: | dispenseCash | 
|---|---|
| Prototype | void dispenseCash(Money amount) const | 
| Purpose | Dispense cash to customer | 
| Receives | amount - amount of money to dispense | 
| Returns | |
| Remarks | Caller must check that requested amount is available before invoking this method.  | 
| ATM:: | acceptEnvelope | 
|---|---|
| Prototype | bool acceptEnvelope() const | 
| Purpose | Accept a deposit envelope from customer. | 
| Receives | |
| Returns | True iff envelope is successfully accepted. | 
| Remarks | Displays request for customer to insert envelope and waits for customer to do so. Times out if customer does not do so within a specified time.  | 
| ATM:: | issueReceipt | ||
|---|---|---|---|
| Prototype | void issueReceipt(
  | ||
| Purpose | Print a receipt for a transaction. | ||
| Receives | cardNumber - number appearing on customer's card serialNumber - transaction serial number - same as sent to bank description - brief description of transaction amount - amount of transaction - 0 if this does not apply balance - balance in account after transaction availableBalance - available balance after transaction  | ||
| Returns | |||
| Remarks | 
| ATM:: | reEnterPIN | 
|---|---|
| Prototype | int reEnterPIN() const | 
| Purpose | Ask customer to re-enter PIN if PIN entered originally was not valid | 
| Receives | |
| Returns | PIN entered by customer | 
| Remarks | Displays request for customer to re-enter PIN, then reads PIN from keyboard. PIN digits are echoed as asterisks to preserve secrecy.  | 
| ATM:: | reportRejection | 
|---|---|
| Prototype | void reportRejection(const char * reason) const | 
| Purpose | Tell customer that the bank has rejected the transaction for some specific reason.  | 
| Receives | reason - brief explanation of reason for rejection | 
| Returns | |
| Remarks | 
| ATM:: | ejectCard | 
|---|---|
| Prototype | void ejectCard() const | 
| Purpose | Return ATM card to customer at end of session. | 
| Receives | |
| Returns | |
| Remarks | 
| ATM:: | retainCard | 
|---|---|
| Prototype | void retainCard() const | 
| Purpose | Permanently retain card due to failure to enter correct PIN. | 
| Receives | |
| Returns | |
| Remarks | Displays screen telling customer the card has been retained and instructing customer to contact the bank.  | 
| ATM:: | number | 
|---|---|
| Prototype | int number() const | 
| Purpose | Provide the ATM's identifying number for inclusion in messages to the bank and on receipts.  | 
| Receives | |
| Returns | ATM's identifying number | 
| Remarks | 
| CardReader:: | CardReader | 
|---|---|
| Prototype | CardReader() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| CardReader:: | ejectCard | 
|---|---|
| Prototype | void ejectCard() | 
| Purpose | Physically eject customer's ATM card. | 
| Receives | |
| Returns | |
| Remarks | 
| CardReader:: | retainCard | 
|---|---|
| Prototype | void retainCard() | 
| Purpose | Physically retain customer's ATM card. | 
| Receives | |
| Returns | |
| Remarks | 
| CardReader:: | checkForCardInserted | 
|---|---|
| Prototype | CardReader::ReaderStatus checkForCardInserted() | 
| Purpose | Report whether or not a readable card has been inserted. | 
| Receives | |
| Returns | NO_CARD if no card has been inserted UNREADABLE_CARD if a card has been inserted incorrectly or is damaged CARD_HAS_BEEN_READ if a card has been inserted and read  | 
| Remarks | 
| CardReader:: | cardNumber | 
|---|---|
| Prototype | int cardNumber() const | 
| Purpose | Return number read from back of card. | 
| Receives | |
| Returns | Card number of card that is currently in the machine. | 
| Remarks | Should only be called after a call to checkForCardInserted has returned CARD_HAS_BEEN_READ.  | 
| Display:: | Display | 
|---|---|
| Prototype | Display() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| Display:: | displayScreen | ||
|---|---|---|---|
| Prototype | void displayScreen(
  | ||
| Purpose | Display specific information on the display. | ||
| Receives | whichScreen - code indicating which screen to display extraInfo - additional text to incorporate into the screen  | ||
| Returns | |||
| Remarks | 
| Display:: | clearDisplay | 
|---|---|
| Prototype | void clearDisplay() | 
| Purpose | Clear the display Screen | 
| Receives | |
| Returns | |
| Remarks | 
| Keyboard:: | Keyboard | 
|---|---|
| Prototype | Keyboard() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| Keyboard:: | readPIN | 
|---|---|
| Prototype | int readPIN() | 
| Purpose | Read a PIN typed in by the user. | 
| Receives | |
| Returns | PIN the user typed. | 
| Remarks | PIN is echoed as asterisks for security. | 
| Keyboard:: | readTransactionChoice | 
|---|---|
| Prototype | Transaction::TransactionType readTransactionChoice() | 
| Purpose | Allow customer to choose a specific transaction type from displayed menu  | 
| Receives | |
| Returns | Code of customer's choice | 
| Remarks | 
| Keyboard:: | readDoAnotherTransactionChoice | 
|---|---|
| Prototype | bool readDoAnotherTransactionChoice() | 
| Purpose | Allow customer to choose "yes" or "no" for wanting to do another transaction.  | 
| Receives | |
| Returns | True iff customer chose yes. | 
| Remarks | 
| Keyboard:: | readAccountChoice | 
|---|---|
| Prototype | Bank::AccountType readAccountChoice() | 
| Purpose | Allow customer to choose an account type from displayed menu  | 
| Receives | |
| Returns | Code of customer's choice | 
| Remarks | 
| Keyboard:: | readWithdrawlAmountChoice | 
|---|---|
| Prototype | Money readWithdrawlAmountChoice() | 
| Purpose | Allow customer to choose a cash withdrawl amount from a displayed menu | 
| Receives | |
| Returns | Dollar amount of customer's choice. | 
| Remarks | 
| Keyboard:: | readAmountEntry | 
|---|---|
| Prototype | Money readAmountEntry() | 
| Purpose | Allow customer to enter a dollar amount. | 
| Receives | |
| Returns | Dollar amount entered by customer. | 
| Remarks | Dollar amount is echoed on screen as customer types it. | 
| Keyboard:: | pressEnterToContinue | 
|---|---|
| Prototype | void pressEnterToContinue() | 
| Purpose | Allow customer to read one screen (normally one reporting an error) before a new screen is displayed.  | 
| Receives | |
| Returns | |
| Remarks | Returns to caller when customer presses ENTER key. | 
| CashDispenser:: | CashDispenser | 
|---|---|
| Prototype | CashDispenser() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| CashDispenser:: | setCash | 
|---|---|
| Prototype | void setCash(Money initialCash) | 
| Purpose | Set amount of cash in dispenser at start of run. | 
| Receives | initialCash - amount of money in dispenser | 
| Returns | |
| Remarks | 
| CashDispenser:: | dispenseCash | 
|---|---|
| Prototype | void dispenseCash(Money amount) | 
| Purpose | Physically dispense cash to customer | 
| Receives | amount - amount of cash to dispense | 
| Returns | |
| Remarks | 
| CashDispenser:: | currentCash | 
|---|---|
| Prototype | Money currentCash() const | 
| Purpose | Report amount of cash currently available to be dispensed. | 
| Receives | |
| Returns | Amount of cash currently available to be dispensed. | 
| Remarks | 
| EnvelopeAcceptor:: | EnvelopeAcceptor | 
|---|---|
| Prototype | EnvelopeAcceptor() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| EnvelopeAcceptor:: | acceptEnvelope | 
|---|---|
| Prototype | bool acceptEnvelope() | 
| Purpose | Physically accept an envelope from customer. | 
| Receives | |
| Returns | True iff envelope is successfully accepted. | 
| Remarks | Times out and returns false if envelope is not inserted within allowed time  | 
| ReceiptPrinter:: | ReceiptPrinter | 
|---|---|
| Prototype | ReceiptPrinter() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| ReceiptPrinter:: | printReceipt | ||
|---|---|---|---|
| Prototype | void printReceipt(
  | ||
| Purpose | Physically print a receipt. | ||
| Receives | theATMnumber - number of the particular ATM theATMlocation - location of the ATM cardNumber - number appearing on customer's card serialNumber - transaction serial number - same as sent to bank description - brief description of transaction amount - amount of transaction - 0 if this does not apply balance - balance in account after transaction availableBalance - available balance after transaction  | ||
| Returns | |||
| Remarks | 
| OperatorPanel:: | OperatorPanel | 
|---|---|
| Prototype | OperatorPanel() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| OperatorPanel:: | switchOn | 
|---|---|
| Prototype | bool switchOn() | 
| Purpose | Report physical setting of the switch. | 
| Receives | |
| Returns | True iff switch is in the "on" position | 
| Remarks | 
| OperatorPanel:: | getInitialCash | 
|---|---|
| Prototype | Money getInitialCash() | 
| Purpose | Get amount of cash in cash dispenser from operator. | 
| Receives | |
| Returns | Amount of money in cash dispenser. | 
| Remarks | 
| Session:: | Session | 
|---|---|
| Prototype | Session(int cardNumber) | 
| Purpose | Constructor | 
| Receives | cardNumber - card number read from customer's ATM card when it was inserted  | 
| Returns | |
| Remarks | 
| Session:: | doSessionUseCase | 
|---|---|
| Prototype | void doSessionUseCase() | 
| Purpose | Implement session use case | 
| Receives | |
| Returns | |
| Remarks | 
| Session:: | doInvalidPINExtension | 
|---|---|
| Prototype | Bank::ApprovalCode doInvalidPINExtension() | 
| Purpose | Perform invalid PIN extension | 
| Receives | |
| Returns | Result of sending transaction to bank with newly entered PIN value | 
| Remarks | Asks user to re-enter PIN and then re-sends current transaction to the bank. If the bank still says the PIN is invalid, this process is repeated up to a maximum of three tries. A third failure will result in the card being retained and the session being aborted.  | 
| Session:: | cardNumber | 
|---|---|
| Prototype | int cardNumber() const | 
| Purpose | Return customer's ATM card number. | 
| Receives | |
| Returns | Customer's ATM card number. | 
| Remarks | 
| Session:: | PIN | 
|---|---|
| Prototype | int PIN() const | 
| Purpose | Return PIN that customer entered at start of session (or re-entered if original was invalid.)  | 
| Receives | |
| Returns | PIN entered by customer. | 
| Remarks | 
| Transaction:: | Transaction | 
|---|---|
| Prototype | Transaction(Session & session) | 
| Purpose | Constructor | 
| Receives | session - reference to session which is creating this transaction | 
| Returns | |
| Remarks | 
| Transaction:: | makeTransaction | ||
|---|---|---|---|
| Prototype | static Transaction * makeTransaction(
  | ||
| Purpose | Create a transaction object of the appropriate subclass as specified | ||
| Receives | type - specific type of transaction to be created session - reference to session which is creating this transaction  | ||
| Returns | Newly created transaction object | ||
| Remarks | Calls constructor for appropriate subclass and returns result | 
| Transaction:: | doTransactionUseCase | 
|---|---|
| Prototype | void doTransactionUseCase() | 
| Purpose | Carry out transaction use case | 
| Receives | |
| Returns | |
| Remarks | This method implements features common to all transactions. The type-specific features are implemented by calling the three abstract methods defined below, in turn.  | 
| Transaction:: and subclasses | getTransactionSpecificsFromCustomer | 
|---|---|
| Prototype | bool getTransactionSpecificsFromCustomer() | 
| Purpose | Get specific information relevant to this transaction from customer. | 
| Receives | |
| Returns | True iff usable information was obtained. | 
| Remarks | This method is abstract in class Transaction, and is implemented concretely for each of its subclasses.  | 
| Transaction:: and subclasses | sendToBank | 
|---|---|
| Prototype | Bank::ApprovalCode sendToBank() | 
| Purpose | Send transaction to bank. | 
| Receives | |
| Returns | ApprovalCode returned by bank. | 
| Remarks | |
| Remarks | This method is abstract in class Transaction, and is implemented concretely for each of its subclasses.  | 
| Transaction:: and subclasses | finishApprovedTransaction | 
|---|---|
| Prototype | void finishApprovedTransaction() | 
| Purpose | Finish a transaction once the bank has approved it. | 
| Receives | |
| Returns | |
| Remarks | |
| Remarks | This method is abstract in class Transaction, and is implemented concretely for each of its subclasses.  | 
| WithdrawlTransaction:: | WithdrawlTransaction | 
|---|---|
| Prototype | WithdrawlTransaction(Session & session) | 
| Purpose | Constructor | 
| Receives | session - reference to session which created this transaction | 
| Returns | |
| Remarks | 
| DepositTransaction:: | DepositTransaction | 
|---|---|
| Prototype | DepositTransaction(Session & session) | 
| Purpose | Constructor | 
| Receives | session - reference to session which created this transaction | 
| Returns | |
| Remarks | 
| TransferTransaction:: | TransferTransaction | 
|---|---|
| Prototype | TransferTransaction(Session & session) | 
| Purpose | Constructor | 
| Receives | session - reference to session which created this transaction | 
| Returns | |
| Remarks | 
| InquiryTransaction:: | InquiryTransaction | 
|---|---|
| Prototype | InquiryTransaction(Session & session) | 
| Purpose | Constructor | 
| Receives | session - reference to session which created this transaction | 
| Returns | |
| Remarks | 
| Bank:: | Bank | 
|---|---|
| Prototype | Bank() | 
| Purpose | Constructor | 
| Receives | |
| Returns | |
| Remarks | 
| Bank:: | initiateWithdrawl | ||
|---|---|---|---|
| Prototype | ApprovalCode initiateWithdrawl(
  | ||
| Purpose | Initiate a withdrawl transaction. | ||
| Receives | cardNumber - number of the customer's ATM Card PIN - PIN entered by the customer ATMnumber - Identifying number of the ATM serialNumber - Serial number of the transaction assigned by ATM from - account from which money is to be withdrawn amount - amount of withdrawl  | ||
| Returns | return value - indicates whether transaction was approved or rejected by the bank, and the reason for rejection if this is the case. newBalance - if the transaction is approved, this is set to balance in account after the transaction availableBalance - if the transaction is approved, this is set to available balance in account after the transaction  | ||
| Remarks | If the transaction is approved, a call to finishWithdrawl must be done to indicate whether or not the transaction was physically completed.  | 
| Bank:: | finishWithdrawl | ||
|---|---|---|---|
| Prototype | void finishWithdrawl(
  | ||
| Purpose | Inform bank whether or not a withdrawl transaction was physically completed by the ATM.  | ||
| Receives | ATMnumber - Identifying number of the ATM serialNumber - Serial number of the transaction assigned by ATM succeeded - true iff transaction was physically completed by the ATM  | ||
| Returns | |||
| Remarks | 
| Bank:: | initiateDeposit | ||
|---|---|---|---|
| Prototype | ApprovalCode initiateDeposit(
  | ||
| Purpose | Initiate a deposit transaction. | ||
| Receives | cardNumber - number of the customer's ATM Card PIN - PIN entered by the customer ATMnumber - Identifying number of the ATM serialNumber - Serial number of the transaction assigned by ATM to - account to which money is to be deposited amount - amount of deposit  | ||
| Returns | return value - indicates whether transaction was approved or rejected by the bank, and the reason for rejection if this is the case. newBalance - if the transaction is approved, this is set to balance in account after the transaction availableBalance - if the transaction is approved, this is set to available balance in account after the transaction.  | ||
| Remarks | If the transaction is approved, a call to finishDeposit must be done to indicate whether or not the transaction was physically completed.  | 
| Bank:: | finishDeposit | ||
|---|---|---|---|
| Prototype | void finishDeposit(
  | ||
| Purpose | Inform bank whether or not a deposit transaction was physically completed by the ATM.  | ||
| Receives | ATMnumber - Identifying number of the ATM serialNumber - Serial number of the transaction assigned by ATM succeeded - true iff transaction was physically completed by the ATM  | ||
| Returns | |||
| Remarks | 
| Bank:: | doTransfer | ||
|---|---|---|---|
| Prototype | ApprovalCode doTransfer(
  | ||
| Purpose | Perform a transfer transaction. | ||
| Receives | cardNumber - number of the customer's ATM Card PIN - PIN entered by the customer ATMnumber - Identifying number of the ATM serialNumber - Serial number of the transaction assigned by ATM from - account from which money is to be transferred to - account to which money is to be transferred amount - amount of transfer  | ||
| Returns | return value - indicates whether transaction was approved or rejected by the bank, and the reason for rejection if this is the case. newBalance - if the transaction is approved, this is set to balance in "to" account after the transaction availableBalance - if the transaction is approved, this is set to available balance in "to" account after the transaction.  | ||
| Remarks | If the transaction is approved, it is completed by this operation. No second method call is needed for this case.  | 
| Bank:: | doInquiry | ||
|---|---|---|---|
| Prototype | ApprovalCode doInquiry(
  | ||
| Purpose | Perform an inquiry transaction. | ||
| Receives | cardNumber - number of the customer's ATM Card PIN - PIN entered by the customer ATMnumber - Identifying number of the ATM serialNumber - Serial number of the transaction assigned by ATM from - account whose balance is desired  | ||
| Returns | return value - indicates whether transaction was approved or rejected by the bank, and the reason for rejection if this is the case. newBalance - if the transaction is approved, this is set to balance in account availableBalance - if the transaction is approved, this is set to available balance in account.  | ||
| Remarks | If the transaction is approved, it is completed by this operation. No second method call is needed for this case.  | 
| Bank:: | accountName | 
|---|---|
| Prototype | const char * accountName(AccountType type) const | 
| Purpose | Return a short name for an account for printing on receipt. | 
| Receives | type - account type whose name is desired | 
| Returns | Printable name for account | 
| Remarks | 
| Bank:: | rejectionDescription | 
|---|---|
| Prototype | const char * rejectionDescription(ApprovalCode code) const | 
| Purpose | Return a brief textual explanation of a particular rejection code the bank returned when a transaction was initiated.  | 
| Receives | code - the rejection code the bank returned | 
| Returns | Explanation for the code. | 
| Remarks |