//ATM Simulation Interface - the ATM itself

ATM Simulation Interface - the ATM itself


/*
 * Example ATM simulation - file atm.h
 *
 * This file declares the class that represents the ATM itself
 *
 * Copyright (c) 1996 - Russell C. Bjork
 *
 */

//

Interface for class ATM

class ATM
  {
    /* 
     * PURPOSE: Manage the overall ATM and its component parts
     */

    public:

	ATM(int number, const char * location);

	// Start up operation

	Money startupOperation();

	// Run the ATM, servicing customers, until the switch is turned off

	void serviceCustomers(Money initialCash);

	// Interact with the customer in support of various use cases

	int getPIN() const;
	Transaction::TransactionType getTransactionChoice() const;
	bool getDoAnotherTransactionChoice() const;
	Bank::AccountType getAccountChoice(const char * purpose) const;
	Money getWithdrawlAmountChoice() const;	// From menu - limited options
	Money getAmountEntry() const;	       	// From keyboard - any amount
	bool checkIfCashAvailable(Money amount) const;
	void dispenseCash(Money amount) const;
	bool acceptEnvelope() const;		// True iff success
	void issueReceipt(int cardNumber,
			  int serialNumber,
			  const char * description,
			  Money amount,
			  Money balance,
			  Money availableBalance) const;
	int reEnterPIN() const;
	void reportRejection(const char * reason) const;
	void ejectCard() const;
	void retainCard() const;
	
	int number() const;

    private:

	enum {RUNNING, STOPPED}	_state;
	int 			_number;
	const char *		_location;

	class CardReader &	_cardReader;
	class Display &		_display;
	class Keyboard &	_keyboard;
	class CashDispenser &	_cashDispenser;
	class EnvelopeAcceptor& _envelopeAcceptor;
	class ReceiptPrinter &	_receiptPrinter;
	class OperatorPanel &	_operatorPanel;
  };

/* The single object of type ATM is global because it pervades the system */

extern ATM theATM;

//