//
/* * Example ATM simulation - file atmparts.h * * This file declares the classes that manage the ATM's components * * Copyright (c) 1996 - Russell C. Bjork * */ //
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; }; //
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(); }; //
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(); }; //
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; }; //
class EnvelopeAcceptor { /* * PURPOSE: Model the ATM component that accepts an envelope during deposits */ public: EnvelopeAcceptor(); bool acceptEnvelope(); }; //
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); }; //
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(); }; //