Question: Can someone help me check my Project 3! Its due tonight and I need to make sure I did everything correct according to the instructions.
Can someone help me check my Project 3! Its due tonight and I need to make sure I did everything correct according to the instructions. Has to work On Visual Studios 2015. Thank you!
C201 Team Project 3
1 Goal
The purpose of this assignment is to get you familiar with class/object and vector. Your goal is to extend the bank database application you implemented in Project 1 and Project 2.
2 Details
Your final program should include five files: bank.h and bank.cpp which were implement before, project3.cpp which is based on project2.cpp, transaction.h and transaction.cpp which are new files. The details are described below.
Do not make changes to bank.h and bank.cpp that you are going to reuse from Project 2.
Two new files, transaction.h and transaction.cpp, are available online. transaction.h contains the declarations of three classes, bank_account, transaction, and account_analysis. transaction.cpp contains the implementation of the methods of three classes declared in transaction.h.
Do not make changes to transaction.h. Instead, complete the method definitions in transaction.cpp.
Start with your finished project2.cpp and create project3.cpp and add three more options to your main program:
Update customer information, which allows the user to change the first name and the last name of an account (the account number and balance should remain unchanged).
List an account information, which allows the user to list a particular account information and its transaction history.
Analyze the transaction history of an account, which allows the user to show the following information about an account: number of transactions, average deposit, average withdraw, maximum deposit, and maximum withdraw.
If you did not finish Project 2, send me an email and I will give you my copy of the completed Project 2.
You are free to choose your new team members and you must state clearly your team members at the beginning of the program.
3 Regulations
The purpose of this project is to use class/object and vector. To add the three options to the main program, you must follow the regulations described below. Otherwise you will significantly lose credit points.
To update customer information, you need (1) retrieve the customer information (account number, first name, last name, and balance); (2) create an instance (object) of bank_account using the constructor bank_account(int, string, string, double); (3) update the object by calling methods reset_first_name(string) and reset_last_name(string); (4) write the updates back to the database by calling methods get_id(), get_first_name(), get_last_name(), and get_balance().
To list an particular account information, you need (1) retrieve the customer information (account number, first name, last name, and balance); (2) create an instance (object) of bank_account using the constructor bank_account(int, string, string, double); (3) display the customer information by calling methods get_first_name(), get_last_name(), and get_balance(); (4) retrieve transactions (account number, transaction type, amount, date and time) about this account and for every transaction, first, create an instance (object) of transaction using the constructor transaction(int, string, double, string), and second, display the transaction by calling method output().
To analyze the transaction history of an account, you need (1) create an object (say AA) of account_analysis using the constructor account_analysis(int); (2) retrieve transactions about this account and for every transaction (account number, transaction type, amount, date and time), first, create an object (say T) of transaction using the constructor transaction(int, string, double, string), and second, insert this object T into the vector container (all_trans) variable of AA by calling method insert_transaction(transaction); (3) display the analysis result by calling method number_transactions(), average_deposit(), average_withdraw(), max_deposit(), and max_withdraw().
bank.cpp file
#include#include #include #include #include #include #include #include "bank.h" #include "transaction.h" void listTransactions() { ifstream fin("transactions.txt"); string transactions; int i = 1; int count = 0; while (getline(fin, transactions)) { cout << i << ". " << transactions << " "; i++; count++; } if (count == 0) { cout << "There are no transactions. Withdraw, Deposit or Transfer Money."; } fin.close(); } string transTime() { stringstream timeString; time_t current_time = time(NULL); string myTime = timeString.str(); return myTime; } void printList(Bank * head) { Bank* temp = head; cout << left << setw(10) << "A/C" << left << setw(12) << "First" << left << setw(12) << "Last" << left << setw(12) << "Balance" << " "; cout << "****************************************** "; while (temp != NULL) { cout << left << setw(10) << temp->account << left << setw(12) << temp->first_name << left << setw(12) << temp->last_name << left << setw(12) << temp->balance << " "; temp = temp->next; } } void freeList(Bank *& head) { Bank * temp = head; Bank * next; while (temp != NULL) { next = temp->next; free(temp); temp = next; } head = NULL; } void orderByAcc(Bank *& head, int acc, string first_name, string last_name, double bal) { Bank *data = new Bank; data->account = acc; data->first_name = first_name; data->last_name = last_name; data->balance = bal; data->next = NULL; if (head == NULL) { head = data; } else if (data->account <= head->account) { data->next = head; head = data; } else { Bank * t1 = head; Bank * t2 = t1->next; while (t2 != NULL && data->account > t2->account) { t1 = t2; t2 = t2->next; } data->next = t2; t1->next = data; } } void orderByBal(Bank *& head, int acc, string first_name, string last_name, double bal) { Bank *data = new Bank; data->account = acc; data->first_name = first_name; data->last_name = last_name; data->balance = bal; data->next = NULL; if (head == NULL) { head = data; } else if (data->balance <= head->balance) { data->next = head; head = data; } else { Bank * t1 = head; Bank * t2 = t1->next; while (t2 != NULL && data->balance > t2->balance) { t1 = t2; t2 = t2->next; } data->next = t2; t1->next = data; } } void sortBy(Bank *& head, Bank * data, string sort) { ifstream fin("bank.txt"); int acc, count = 0; string first_name, last_name; double bal; while (fin >> acc >> first_name >> last_name >> bal) { count++; if (sort == "account") orderByAcc(head, acc, first_name, last_name, bal); else if (sort == "balance") orderByBal(head, acc, first_name, last_name, bal); } if (count == 0) cout << "Bank Database is empty. "; fin.close(); }
bank.h
#include#include #include #include #include #include using namespace std; struct Bank { int account; string first_name, last_name; double balance; Bank * next; }; void introText(); void addAcc(int, string, string, double); void delAcc(int); void searchAcc(int); void withdraw(int, double); void deposit(int, double); void transfer(int, int, double); void listAcc(); /*This function is used to call orderByAcc or orderByBal depending on what we want to sort account by. */ void sortBy(Bank *& head, Bank * data, string); void orderByBal(Bank *& head, int, string, string, double); void orderByAcc(Bank *& head, int, string, string, double); void freeList(Bank *& head); void printList(Bank * head); void listTransactions(); string transTime(); void updateAcc(int); void accInfo(int); string transTime(); void analyze(int acc);
Project3.cpp
#include
using namespace std;
int main() { Bank * head = NULL; Bank * temp = new Bank; bool exit = false;
cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2);
while (exit == false) { introText();
int response, acc; double bal, withdrawAmount, depositAmount; string first_name, last_name, sort;
cout << "Your selection" << " "; cin >> response; cout << " ";
switch (response) {
case 1: cout << "Enter account number : "; cin >> acc;
cout << "Enter first name : "; cin >> first_name;
cout << "Enter last name : "; cin >> last_name;
cout << "Enter account balance : "; cin >> bal; addAcc(acc, first_name, last_name, bal); break;
case 2: cout << "Enter account number you wish to delete : "; cin >> acc; delAcc(acc); break;
case 3: cout << "Enter account number you are looking for : "; cin >> acc; searchAcc(acc); break;
case 4: cout << "Enter account number you want to withdraw from "; cin >> acc;
cout << "Enter amount you want to withdraw "; cin >> withdrawAmount;
withdraw(acc, withdrawAmount); break;
case 5: cout << "Enter account number you want to deposit into "; cin >> acc;
cout << "Enter amount you want to deposit "; cin >> depositAmount; deposit(acc, depositAmount); break;
case 6: int transFromAcc, transToAcc; double transferAmount; cout << "Enter account you want to transfer from "; cin >> transFromAcc;
cout << "Enter account you want to transfer in "; cin >> transToAcc;
cout << "Enter amount you want to transfer "; cin >> transferAmount;
transfer(transFromAcc, transToAcc, transferAmount); break;
case 7: listAcc(); break;
case 8: sort = "account"; sortBy(head, temp, sort); printList(head); freeList(head); break;
case 9: sort = "balance"; sortBy(head, temp, sort); printList(head); freeList(head); break;
case 10: listTransactions(); break;
case 11: cout << "Enter account number to Update: "; cin >> acc; updateAcc(acc); break;
case 12: cout << "Enter account number : "; cin >> acc; accInfo(acc); break;
case 13: cout << "Enter account number you want to analyze : "; cin >> acc; analyze(acc); break;
case 14: exit = true; break;
default: cout << "Wrong selection. Response must be between 1 and 14 "; } } return 0; }
void introText() { cout << " ************************************ "; cout << "Please make your selections: "; cout << "1. Add an account "; cout << "2. Delete an account "; cout << "3. Search an account "; cout << "4. Make a withdraw "; cout << "5. Make a deposit "; cout << "6. Transfer money "; cout << "7. List all records (no order required) "; cout << "8. List all records in the increasing order of account number "; cout << "9. List all records in the increasing order of account balance "; cout << "10. List all transactions (no order required) "; cout << "11. Update customer Information "; cout << "12. List an account information "; cout << "13. Analyze an account transaction "; cout << "14. Exit the program "; cout << "************************************ "; }
void addAcc(int accNum, string fname, string lname, double accBal) { ifstream fin("bank.txt");
int count = 0, acc; double bal; string first_name, last_name;
while (fin >> acc >> first_name >> last_name >> bal) { if (acc == accNum) { count++; ofstream temp("temp.txt"); temp << acc << " " << first_name << " " << last_name << " " << bal; temp.close(); } } fin.close();
if (count == 0) { ofstream fout("bank.txt", ios::app);
fout << left << setw(10) << accNum << left << setw(12) << fname << " " << left << setw(12) << lname << " " << left << setw(12) << accBal << " "; cout << " New Account Inserted. ";
fout.close();
ofstream transout("transactions.txt", ios::app);
transout << left << setw(8) << accNum << left << setw(12) << "Deposit" << left << setw(10) << accBal << left << setw(10) << transTime() << " "; transout.close();
remove("temp.txt"); }
//Same account number found. Print it out. if (count > 0) { ifstream output("temp.txt"); string custInfo;
while (getline(output, custInfo)) { cout << " " << custInfo << " "; } cout << "Same account is found. The account can't be added. "; output.close(); remove("temp.txt"); } }
void listAcc() { ifstream fin("bank.txt");
string custInfo;
int i = 1, count = 0;
cout << left << setw(10) << "A/C" << left << setw(13) << "First" << left << setw(13) << "Last" << left << setw(12) << "Balance" << " "; cout << "****************************************** "; while (getline(fin, custInfo)) { cout << custInfo << " "; i++; count++; }
if (count == 0) { cout << "Your database is empty. Press 1 to add an account."; }
fin.close(); }
void searchAcc(int acc) { ifstream fin("bank.txt");
int accNum, count = 0; string first_name, last_name; double bal;
while (fin >> accNum >> first_name >> last_name >> bal) { if (acc == accNum) { ofstream fout("temp.txt"); fout << accNum << " " << first_name << " " << last_name << " " << bal; count++; fout.close(); } }
if (count == 0) { cout << " Could not find this account "; }
fin.close();
ifstream temp("temp.txt"); string custInfo;
while (getline(temp, custInfo)) { cout << " " << custInfo << " "; } temp.close();
remove("temp.txt"); }
void delAcc(int acc) { ifstream fin("bank.txt"); ofstream fout("temp.txt");
int accNum, count = 0; string first_name, last_name; double bal;
//All accounts that we do not want to delete should be copied into another file. while (fin >> accNum >> first_name >> last_name >> bal) { if (acc != accNum) { fout << left << setw(10) << accNum << left << setw(12) << first_name << " " << left << setw(12) << last_name << " " << left << setw(12) << bal << " "; }
else { count++; } }
//Account could not be found. if (count == 0) { cout << " Could not find this account. "; }
fin.close(); fout.close();
//Rename temp file back to bank.txt and delete temp file. Account deleted. if (count > 0) { ifstream temp("temp.txt"); string custInfo;
temp.close();
remove("bank.txt"); rename("temp.txt", "bank.txt");
cout << " Account deleted."; } }
void withdraw(int acc, double withdrawAmount) { ifstream fin("bank.txt"); ofstream fout("temp.txt");
int accNum, custNum; double custAccBal, bal; string custFirstName, custLastName, first_name, last_name;
int count = 0;
//If account number is found, save the each word/number from that account to a variable. while (fin >> accNum >> first_name >> last_name >> bal) { if (acc == accNum) { count++; custNum = acc; custFirstName = first_name; custLastName = last_name; custAccBal = bal; }
//This will copy all copy all account that does not match account we want to withdraw from into temp file if (acc != accNum) { fout << left << setw(10) << accNum << left << setw(12) << first_name << " " << left << setw(12) << last_name << " " << left << setw(12) << bal << " "; } }
fin.close(); fout.close();
if (count > 0) { //check if account balance is greater than amount to be withdrawn if (withdrawAmount > custAccBal) { cout << " Not enough money in the account. "; }
//If amount to be withdrawn is equal to or less than account balance, then withdraw. if (withdrawAmount <= custAccBal) { custAccBal = custAccBal - withdrawAmount;
ofstream fout("temp.txt", ios::app);
fout << left << setw(10) << custNum << left << setw(12) << custFirstName << " " << left << setw(12) << custLastName << " " << left << setw(12) << custAccBal << " "; remove("bank.txt");
fout.close();
rename("temp.txt", "bank.txt");
cout << " Money was successfully withdrawn.";
ofstream transout("transactions.txt", ios::app);
transout << left << setw(8) << custNum << left << setw(12) << "Withdraw" << left << setw(10) << withdrawAmount << left << setw(10) << transTime() << " "; transout.close(); } }
if (count == 0) //Account not found. { cout << " This account does not exist. "; remove("temp.txt"); } }
void deposit(int acc, double depositAmount) { ifstream fin("bank.txt"); ofstream fout("temp.txt");
int accNum, custNum; double custAccBal, bal; string custFirstName, custLastname, first_name, last_name;
int count = 0;
while (fin >> accNum >> first_name >> last_name >> bal) { if (acc == accNum) { count++; custNum = accNum; custFirstName = first_name; custLastname = last_name; custAccBal = bal; }
else { fout << left << setw(10) << accNum << left << setw(12) << first_name << " " << left << setw(12) << last_name << " " << left << setw(12) << bal << " "; } }
fin.close(); fout.close();
if ((count > 0) && (depositAmount >= 0)) { custAccBal = custAccBal + depositAmount;
ofstream fout("temp.txt", ios::app);
fout << left << setw(10) << custNum << left << setw(12) << custFirstName << " " << left << setw(12) << custLastname << " " << left << setw(12) << custAccBal << " "; remove("bank.txt");
fout.close();
rename("temp.txt", "bank.txt");
cout << " Money was successfully deposited.";
ofstream transout("transactions.txt", ios::app);
transout << left << setw(8) << custNum << left << setw(12) << "Deposit" << left << setw(10) << depositAmount << left << setw(10) << transTime() << " "; transout.close(); }
//Account not found. if ((count == 0) || (depositAmount < 0)) { cout << " This account does not exist, or you are depositing a negative amount "; remove("temp.txt"); } }
void transfer(int transFromAcc, int transToAcc, double transferAmount) { ifstream fin("bank.txt");
int fromAcc, toAcc, accNum; double fromBal, toBal, bal; bool boolfromAcc = false, booltoAcc = false, boolTransBal = false; string fromFirstName, fromLastName, toFirstName, toLastName, first_name, last_name;
int count = 1;
//By default, this loop will save all accounts that are not part of the transfer process (withdraw and deposit.) while (fin >> accNum >> first_name >> last_name >> bal) {
if ((accNum != transFromAcc) && (accNum != transToAcc)) { ofstream fout("temp.txt", ios::app);
fout << left << setw(10) << accNum << left << setw(12) << first_name << " " << left << setw(12) << last_name << " " << left << setw(12) << bal << " ";
fout.close(); }
//If transferring account is found on file, it's data should be stored in variables. And then return true. if (accNum == transFromAcc) { fromAcc = accNum; fromFirstName = first_name; fromLastName = last_name; fromBal = bal;
boolfromAcc = true;
//If Amount to be transferred is greater than the available balance, then return true. if (transferAmount <= fromBal) { boolTransBal = true; } }
//If depositing account is found on file, it's data should be stored in variables. Then return true. if (accNum == transToAcc) { toAcc = accNum; toFirstName = first_name; toLastName = last_name; toBal = bal;
booltoAcc = true; } } fin.close();
if ((boolfromAcc) && (booltoAcc) && (boolTransBal)) { fromBal = fromBal - transferAmount; toBal = toBal + transferAmount;
ofstream fout("temp.txt", ios::app);
fout << left << setw(10) << fromAcc << left << setw(12) << fromFirstName << " " << left << setw(12) << fromLastName << " " << left << setw(12) << fromBal << " "; fout << left << setw(10) << toAcc << left << setw(12) << toFirstName << " " << left << setw(12) << toLastName << " " << left << setw(12) << toBal << " ";
ofstream transout("transactions.txt", ios::app); string transactionTime = transTime();
transout << left << setw(8) << fromAcc << left << setw(12) << "Withdraw" << left << setw(10) << transferAmount << left << setw(10) << transactionTime << " "; transout << left << setw(8) << toAcc << left << setw(12) << "Deposit" << left << setw(10) << transferAmount << left << setw(10) << transactionTime << " "; transout.close();
remove("bank.txt");
fout.close();
rename("temp.txt", "bank.txt");
cout << " Transfer successful. "; }
if ((boolfromAcc) && (booltoAcc) && (!boolTransBal)) { cout << " Balance in first account is less than amount you want to transfer "; remove("temp.txt"); }
if ((!boolfromAcc) || (!booltoAcc)) { cout << " Either one of the accounts does not exist"; remove("temp.txt"); } }
void updateAcc(int acc) { ifstream fin("bank.txt"); ofstream fout("temp.txt");
int accNum, aNum, count = 0; string fname, first_name, lname, last_name; double accBal, bal;
while (fin >> accNum >> first_name >> last_name >> bal) { if (acc == accNum) { aNum = accNum; fname = first_name; lname = last_name; accBal = bal; count++; } else { fout << accNum << " " << first_name << " " << last_name << " " << bal << " "; } }
fin.close(); fout.close();
if (count == 0) { cout << " Could not find this account. "; } else { cout << "The first name of this account holder is : " << fname << " "; cout << "The last name of this account holder is : " << lname << " ";
string newFirstName; string newLastName;
cout << "Enter new first name : "; cin >> newFirstName; cout << "Enter new last name : "; cin >> newLastName;
bank_account Customer(aNum, fname, lname, accBal);
Customer.reset_first_name(newFirstName); Customer.reset_last_name(newLastName);
ofstream fout("temp.txt", ios::app); fout << Customer.get_id() << " " << Customer.get_first_name() << " " << Customer.get_last_name() << " " << Customer.get_balance() << " "; fout.close(); remove("bank.txt"); rename("temp.txt", "bank.txt"); cout << " The customer name was successfully updated. "; } }
void accInfo(int acc) { ifstream fin("bank.txt");
int accNum, custNum = 0; double custAccBal = 0, bal; string custFirstName, custLastname, first_name, last_name;
int count = 0;
while (fin >> accNum >> first_name >> last_name >> bal) { if (acc == accNum) { count++; custNum = accNum; custFirstName = first_name; custLastname = last_name; custAccBal = bal; } }
fin.close();
if (count > 0) { bank_account Customer(custNum, custFirstName, custLastname, custAccBal);
cout << " The account information is listed below : "; cout << "Customer Name : " << Customer.get_first_name() << " " << Customer.get_last_name() << " "; cout << "Account Balance is : " << Customer.get_balance() << " "; } else //Account not found(deleted :)) in bank.txt, but there could be transactions on the account in transactions.txt cout << " Account deleted/does not exist. But here are their transactions. ";
fin.close();
ifstream ftrans("transactions.txt");
string transType, weekDay, month, time; int dayOfTrans, year; double amount;
cout << left << setw(32) << "Date & Time" << "Amount "; cout << "*************************************** "; while (ftrans >> accNum >> transType >> amount >> weekDay >> dayOfTrans >> month >> year >> time) { if (acc == accNum) { string date_and_time = weekDay + " " + to_string(dayOfTrans) + " " + month + " " + to_string(year) + " " + time;
transaction transaction(accNum, transType, amount, date_and_time);
transaction.output(); } }
ftrans.close(); }
void analyze(int acc) { account_analysis AA(acc);
ifstream fin("transactions.txt"); string transType, weekDay, month, time; int dayOfTrans, year, accNum, count = 0; double amount;
while (fin >> accNum >> transType >> amount >> weekDay >> dayOfTrans >> month >> year >> time) { if (acc == accNum) { count++; string date_and_time = weekDay + " " + to_string(dayOfTrans) + " " + month + " " + to_string(year) + " " + time; transaction T(accNum, transType, amount, date_and_time); AA.insert_transaction(T); } }
if (count != 0) { cout << " The number of transactions is : " << AA.number_transactions() << " "; cout << "The average deposit is : $" << AA.average_deposit() << " "; cout << "The maximum deposit is : $" << AA.max_deposit() << " "; cout << "The Average withdraw is : $" << AA.average_withdraw() << " "; cout << "The maximum withdraw is : $" << AA.max_withdraw() << " ";
} else cout << " Either this account does not exist or has no transaction. ";
fin.close(); }
transaction.cpp
#include#include #include #include "transaction.h" //initialize bankaccount and set Customer_ID to id, first_name to fname, last_name to lname, and balance to b bank_account::bank_account(int id, string fname, string lname, double b) { Customer_ID = id; first_name = fname; last_name = lname; balance = b; } bank_account::bank_account() { Customer_ID = 9999; first_name = "anonymous"; last_name = "anonymous"; balance = 0; } //rest first_name to s void bank_account::reset_first_name(string s) { first_name = s; } //reset last_name to s void bank_account::reset_last_name(string s) { last_name = s; } int bank_account::get_id() { return Customer_ID; } string bank_account::get_first_name() { return first_name; } //return last name string bank_account::get_last_name() { return last_name; } // return balance double bank_account::get_balance() { return balance; } transaction::transaction(int act, string type, double a, string day) : account_number(act), transaction_type(type), amount(a), date_and_time(day) { } transaction::transaction() { account_number = 9999; transaction_type = "unknown"; amount = 0; date_and_time = "unknown"; } int transaction::get_account_number() { return account_number; } string transaction::get_transaction_type() { return transaction_type; } double transaction::get_amount() { return amount; } string transaction::get_transaction_date() { return date_and_time; } void transaction::output() { if (transaction_type == "Deposit") { cout << date_and_time << "\t" << "+" << amount << " USD "; } else if (transaction_type == "Withdraw") { cout << date_and_time << "\t" << "-" << amount << " USD "; } } //constructor account_analysis::account_analysis(int id) { this->id = id; } //insert a transaction into the vector void account_analysis::insert_transaction(transaction t) { all_trans.push_back(t); } //return the number of transactions in the vector int account_analysis::number_transactions() { return all_trans.size(); } //return the average amount of deposit double account_analysis::average_deposit() { int i = 0; double totalDeposit = 0; for (vector ::iterator Iter = all_trans.begin(); Iter != all_trans.end(); ++Iter) { if (Iter->get_transaction_type() == "Deposit") { i++; totalDeposit += Iter->get_amount(); } } if (i == 0) return 0; else return (totalDeposit / static_cast (i)); } //return the average amount of withdraw double account_analysis::average_withdraw() { int i = 0; double totalWithdraw = 0; for (vector ::iterator Iter = all_trans.begin(); Iter != all_trans.end(); ++Iter) { if (Iter->get_transaction_type() == "Withdraw") { i++; totalWithdraw += Iter->get_amount(); } } if (i == 0) return 0; else return (totalWithdraw / static_cast (i)); } //return the maximum amount of deposit double account_analysis::max_deposit() { vector maxDeposit; for (vector ::iterator Iter = all_trans.begin(); Iter != all_trans.end(); ++Iter) { if (Iter->get_transaction_type() == "Deposit") { maxDeposit.push_back(Iter->get_amount()); } } if (maxDeposit.empty()) return 0; else { vector ::iterator max; max = max_element(maxDeposit.begin(), maxDeposit.end()); return *max; } } //return the maximum amount of withdraw double account_analysis::max_withdraw() { vector maxWithdraw; for (vector ::iterator Iter = all_trans.begin(); Iter != all_trans.end(); ++Iter) { if (Iter->get_transaction_type() == "Withdraw") { maxWithdraw.push_back(Iter->get_amount()); } } if (maxWithdraw.empty()) return 0; else { vector ::iterator max; max = max_element(maxWithdraw.begin(), maxWithdraw.end()); return *max; } }
transaction.h
//do not make changes to this file #include#include using namespace std; class bank_account { private: int Customer_ID; string first_name; string last_name; double balance; public: bank_account(int, string, string, double); bank_account(); void reset_first_name(string); void reset_last_name(string); int get_id(); string get_first_name(); string get_last_name(); double get_balance(); }; class transaction { private: int account_number; string transaction_type; double amount; string date_and_time; public: transaction(int, string, double, string); transaction(); int get_account_number(); string get_transaction_type(); double get_amount(); string get_transaction_date(); void output(); }; class account_analysis { private: int id; //account number vector all_trans; public: account_analysis(int); void insert_transaction(transaction); int number_transactions(); double average_deposit(); double average_withdraw(); double max_deposit(); double max_withdraw(); };
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
