#include "BankAccount.h" #include #include using namespace std; BankAccount::BankAccount(const string & name) { accountHolder = name; currentBalance = 0; feesPayable = 0; tranAmount = 0; } void BankAccount::Deposit(double amount) { feesPayable += FEE_PAYABLE; currentBalance += amount; AddTransaction(amount, currentBalance, "[D]"); } void BankAccount::Withdraw(double amount) { if (amount > currentBalance) { cout << "Insufficient funds!" << endl; } else { feesPayable += FEE_PAYABLE; currentBalance -= amount; AddTransaction(amount, currentBalance, "[W]"); } } string BankAccount::GetAccountHolder() const { return accountHolder; } double BankAccount::GetBalance() const { return currentBalance; } double BankAccount::GetFeesPayable() const { return feesPayable; } void BankAccount::AddTransaction(double amount, double balance, const string & type) { stringstream oss; oss << type << " " << amount << "\tNew balance: " << currentBalance; if (tranAmount == TRAN_SIZE) { RemoveTransaction(); } tranList[tranAmount] = oss.str(); tranAmount++; } void BankAccount::RemoveTransaction() { if (tranAmount != 0) { tranList[0] = ""; for (int i=0;i