//ATM Simulation Interface - ATM components

ATM Simulation Interface - ATM components


/*
 * Example ATM simulation - file atmparts.h
 *
 * This file declares the classes that manage the ATM's components
 *
 * Copyright (c) 1996 - Russell C. Bjork
 *
 */

//

Interface for class CardReader

class CardReader
  {
    /* 
     * PURPOSE: Model the ATM component that reads a customer's card
     */

    public:

	CardReader();

	void ejectCard();
	void retainCard();

	enum ReaderStatus 
	  { NO_CARD, UNREADABLE_CARD, CARD_HAS_BEEN_READ };

	ReaderStatus checkForCardInserted();
	int cardNumber() const;

    private:

	ReaderStatus	_status;
	int		_cardNumberRead;	
  };

//

Interface for class Display

class Display
  {
    /* 
     * PURPOSE: Model the ATM component that displays messages for the customer
     */

    public:

	Display();

	// A particular screen that is to be displayed is specified by a
	// member of this enumeration

	enum Screen
	  { // The following request the customer to perform some
	    // specific action
	    INSERT_CARD, ENTER_PIN, 
	    CHOOSE_TRANSACTION, WANT_ANOTHER_TRANSACTION,
	    CHOOSE_ACCOUNT, CHOOSE_AMOUNT, ENTER_AMOUNT,
	    DEPOSIT_ENVELOPE,
	    // The following inform the customer of some problem
	    CARD_UNREADABLE, NOT_ENOUGH_CASH, TRANSACTION_REJECTED,
	    INVALID_PIN, CARD_RETAINED
	  };

	void displayScreen(Screen whichScreen, const char * extraInfo = NULL);
	void clearDisplay();
  };

//

Interface for class Keyboard

class Keyboard
  {
    /* 
     * PURPOSE: Model the ATM component that accepts input from the customer
     */

    public:

	Keyboard();

	int readPIN();
	Transaction::TransactionType readTransactionChoice();
	bool readDoAnotherTransactionChoice();
	Bank::AccountType readAccountChoice();
	Money readWithdrawlAmountChoice();
	Money readAmountEntry();
	void pressEnterToContinue();
  };

//

Interface for class CashDispenser

class CashDispenser
  {
    /* 
     * PURPOSE: Model the ATM component that dispenses cash during withdrawls
     */

    public:

	CashDispenser();

	void setCash(Money initialCash);
	void dispenseCash(Money amount);
	Money currentCash() const;

    private:

	Money _currentCash;
  };

//

Interface for class EnvelopeAcceptor

class EnvelopeAcceptor
  {
    /* 
     * PURPOSE: Model the ATM component that accepts an envelope during deposits
     */

    public:

	EnvelopeAcceptor();

	bool acceptEnvelope();
  };

//

Interface for class ReceiptPrinter

class ReceiptPrinter
  {
    /* 
     * PURPOSE: Model the ATM component that prints switch
     */

    public:

	ReceiptPrinter();

	void printReceipt(int theATMnumber,
			  const char * theATMlocation,
			  int cardNumber,
			  int serialNumber,
			  const char * description,
			  Money amount,
			  Money balance,
			  Money availableBalance);
  };

//

Interface for class OperatorPanel

class OperatorPanel
  {
    /* 
     * PURPOSE: Model the ATM component that allows an operator to stop
     *		the machine for maintenance
     */

    public:

	OperatorPanel();

	bool switchOn();		// True iff "on"
	Money getInitialCash();
  };

//