// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 1170, Spring 2009 // Lab 30: Header file Lab 30 // Date: January 12, 2009 // Comment: The code here is meant to be revised. // ***************************************************************** #include #include #include #include using namespace std; #ifndef LAB_30_HEAD_H #define LAB_30_HEAD_H struct transactionType { string type; //"deposit" or "withdraw", or "transfer" double amount; //amount in the transaction }; //define studentClass class class accountType { private: string firstName, //first name of customer lastName; //last name of customer string ID; //account ID double balance; //account balance string pwd; //password for the account bool activeOrClosed; //status of the account vector activities; //activity log of the account public: accountType(); //default constructor accountType(const string fn, const string ln, //another constructor const string id, const double bal, const string pwdStr); void deposit(const double amount); //method to make a deposit bool withdraw(const double amount); //make a withdraw bool transfer(const double amount, accountType & dest); string getName() {return firstName + " " + lastName;} //inline method to get the name string getID(){return ID;} //inline method to get the ID string getPwd(){return pwd;} //inline method to get the pwd double getBalance(){return balance;} //inline method to get the balance bool checkPwd(const string str){return pwd == str;} //inline method to check password void print(); //print account report void open(const string fn, const string ln, //method to open an account const string id, const double bal, const string pwdStr); void close(const string fn, const string ln,//close the account const string id, const string pwdStr); }; //default constructor accountType:: accountType() { firstName = ""; //first name of customer lastName = ""; //last name of customer ID = -1; //account ID balance = 0; //account balance pwd = ""; //password for the account activeOrClosed = true; //status of the account activities.clear(); //clear the activity vector } //another constructor accountType:: accountType(const string fn, const string ln, const string id, const double bal, const string pwdStr) { open(fn, ln, id, bal, pwdStr); //call open method to open the account } //method to make a deposit void accountType:: deposit(const double amount) { transactionType tmp; //var to log the transaction type balance += amount; //make the deposit tmp.type = "deposit"; //log the transaction tmp.amount = amount; activities.push_back(tmp); } //make a withdraw bool accountType:: withdraw(const double amount) { transactionType tmp; //var to log the transaction type if (balance < amount) { cout<<" Your balance is "<