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/

No comments:

Post a Comment