The DejaVU Framework -- hush 3.1

include: professional-program-21-BankAccount-BankDB.h /cygdrive/d/www/media


- [up] [top] - index make include source logic grammar scripts html configure mx slides talks scenes reports projects
<body bgcolor="#FFFFFF" text="#000000">

include 
include 
include 
using std::map;
using std::string;
using std::out_of_range;

<h4 align=right text=red> BankAccount</h4><hr>
  class BankAccount
{
 public:
  BankAccount(int acctNum, const string& name) :
    mAcctNum(acctNum), mClientName(name) {}
  void setAcctNum(int acctNum) { mAcctNum = acctNum; }
  int getAcctNum() const {return (mAcctNum); }
  void setClientName(const string& name) { mClientName = name; }
  string getClientName() const { return mClientName; }

  // Other public methods omitted

 protected:
  int mAcctNum;
  string mClientName;
  // other data members omitted
};
<hr>


<hr>

BankDB</h4>
  class BankDB
  {
   public:
    BankDB() {}
  
    // Adds acct to the bank database. If an account
    // exists already with that number, the new account is
    // not added. Returns true if the account is added, false
    // if it's not.
    bool addAccount(const BankAccount& acct);
  
    // Removes the account acctNum from the database.
    void deleteAccount(int acctNum);
  
    // Returns a reference to the account represented
    // by its number or the client name.
    // Throws out_of_range if the account is not found
    BankAccount& findAccount(int acctNum) throw(out_of_range);
    BankAccount& findAccount(const string& name) throw(out_of_range);
  
    // Adds all the accounts from db to this database.
    // Deletes all the accounts in db.
    void mergeDatabase(BankDB& db);
  
   protected:
    map<int, BankAccount> mAccounts;
  };


  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author. <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2780434-1"; urchinTracker(); </script>

Hush Online Technology
hush@cs.vu.nl
10/19/08