// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 1170, Spring 2009 // Lab 30: More classes, a bank exmaple // Date: January 12, 2009 // Comment: The code here is meant to be revised. // //----------------------------------------------------------------- // // This lab exercise is to more class exercise. We shall define a // bank account class along with necessary methods. We then write a // driver program to manage bank accounts for customers. // // The program is not complete. Your job to complete this progam for all options // and add as many features as you can. // // Compile and run your program. When everything is fine, // print your .cpp and .h files and turn them to me or the TA. // ***************************************************************** #include < iostream > #include #include < string > #include < cstring > #include < cmath> #include #include #include "lab_30_head.h" using namespace std; int main( ) { //declare a vector of accounts vector bank; accountType acount; //an account object transactionType tans; //a transaction object string fn, ln, id, pwdStr; //vars for names, IDs, and passwords double amt; //var to amount char flag; //loop control flag char option; //switch option int i, index; //loop vars bool found; //for searching do { showMenu(); cout << " Enter your option => "; cin >> option; switch(option) { case 'o'://open an account //get necessary info cout<<"Enter your first name => "; cin>>fn; cout<<"Enter your last name => "; cin>>ln; cout<<"Enter your aacount ID => "; cin>>id; cout<<"Enter your initial deposit => "; cin>>amt; cout<<"Enter your password => "; cin>>pwdStr; //add the account into the bank bank.push_back(accountType(fn, ln, id, amt, pwdStr)); break; case 'd'://make a deposit //get necessary info // for you to complete break; case 'w'://make a withdraw //get necessary info // for you to complete break; case 't'://make a transfer //get necessary info // for you to complete break; case 'c'://print account report //get necessary info // for you to complete break; case 'p'://close an account // for you to complete // the following is a partial solution cout<<"Enter an count ID => "; cin>>id; //search for the account in the bank found = false; for (i=0; i "; cin>>pwdStr; if(pwdStr == bank[i].getPwd()) //password verified { bank[i].print(); } else { cout<<"Password is not right. Request is denied. " < "; cin>>flag; } while (flag =='y' || flag =='Y'); //well done and exit return 0; }