Tuesday, June 14, 2016

Design ATM Machine

Design ATM Machine


class ATM; class ReceiptInfo;
class ATMImpl{
 friend class ATM;
 private:
  ATMImpl(){/*implementation*/}
 public:
  float getBalanceInfo(){/*implementation*/}
  ReceiptInfo getReceiptInfo(){/*implementation*/}
  bool deposit(float val){/*implementation*/}
  bool withdraw(float val){/*implementation*/}
  bool verifyPIN(int pinVal){/*implementation*/}
  ~ATMImpl(){/*implementation*/}
};
class ATM{
 private:
  ATMImpl *d; //pointer to ATM implementation
 public:
  inline float getBalance(){return d->getBalance();}
  inline ReceiptInfo getReceiptInfo(){return d->getReceiptInfo();}
  inline bool deposit(float val){return d->deposit(val);}
  inline bool withdraw(float val){return d->withdraw(val);}
  inline bool verifyPIN(int pinVal){return d->verifyPIN(pinVal);}
};

class ATM_GUI{
 private:
  ATM atmObj;
 public:
  ATM_GUI(){/*initialize GUI*/}
  void printReceipt(){atmObj.getReceiptInfo();/*more implementation*/}
  void printBalance(){atmObj.getBalance();/*more implementation*/}
  inline bool verifyPIN(int pinVal){atmObj.verifyPIN(pinVal);}
  inline bool withdraw(float amount){atmObj.withdraw(amount);}//Atomic operation
  inline bool deposit(float amount){atmObj.deposit(amount);}//Atomic operation
  //more methods (operations)
};
http://www.ijser.org/researchpaper/Designing-and-Implementing-of-ATM-System-Using-Object-Oriented-Approach.pdf
http://www.math-cs.gordon.edu/courses/cs211/ATMExample/

1 comment:

  1. Civil Lab Equipment Manufacturer is the leading Manufacturer, Supplier and Exporter of Civil Engineering Lab Equipments or instruments. Established in 2005.

    Mob: +91-9891445495, +91-8448366515, +918587026175
    Phone : +91-11-23657121
    Website : http://setestindia.com, http://civillabequipmentmanufacturer.com/

    ReplyDelete