Question: C++ USING CLASSES INHERITANCE INCLUDE ACCOUNT.H, ACCOUNT.CPP, SAVINGSACCOUNT.H, SAVINGSACCOUNT.H.CPP, CHECKINGACCOUNT.H, CHECKINGACCOUNT.CPP, AND MAIN.CPP Create a bank with two different types of bank accounts available. Each

C++ USING CLASSES INHERITANCE

INCLUDE ACCOUNT.H, ACCOUNT.CPP, SAVINGSACCOUNT.H, SAVINGSACCOUNT.H.CPP, CHECKINGACCOUNT.H, CHECKINGACCOUNT.CPP, AND MAIN.CPP

Create a bank with two different types of bank accounts available. Each type of account has the following information: the account starts at zero balance so the user can deposit and withdraw money. 1) A first and last name for the account holder. 2) A routing number for the bank. 3) An account number. 4) A balance amount. 5) A transaction history, the transaction history must be a Vector 6) Methods for withdrawing money, depositing money, checking the account balance, and checking the transaction history.

7) The first type of Account, a "Savings Account", will inherit from "Account" and introduce the following features: Maintain a count of the number of withdrawls and, if it exceeds 6, reject the withdrawl. Not allow overdraft - if the withdrawl amount exceeds the account balance, reject the transaction.

8) The second type of Account, a "Checking Account", will inherit from "Account" and introduce the following features: If the user attempts to withdraw more than they have available in their account, apply an overdraft fee of $35. Allow total overdraft of up to $500 (including fees). If the account withdrawl + fees will make the user more than $500 overdrafted then reject the transaction.

INITIAL TEMPLATE :

#ifndef ACCOUNT_H #define ACCOUNT_H #include class Account { public: Account(std::string firstName, std::string lastName, double openingBalance); ~Account(); std::string getFirstName(); std::string getLastName(); bool withdraw(double amount); bool deposit(double amount); static std::string getRoutingNumber();

double getBalance();

//ADD TRANSACTION HISTORY VECTOR

private: std::string firstName; std::string lastName;

std::string accountNumber: std::string routingNumber; double balance; };

=============================================== SavingAccount.h

#ifndef SAVINGS_H #define SAVINGS_H #include #include "Account.h" class SavingsAccount : public Account { public: SavingsAccount(std::string firstName, std::string lastName, double balance); ~SavingsAccount(); bool withdraw(double amount); private: int withdrawCount; }; #endif

========================= CheckingAccount.h

#ifndef CHECKING_H #define CHECKING_H #include #include "Account.h" class CheckingAccount : public Account { public: CheckingAccount(std::string pFirstName, std::string pLastName, double pBalance); ~CheckingAccount(); bool withdraw(double amount); }; #endif

======================================== main.cpp

#include "SavingsAccount.h" #include "CheckingAccount.h" #include using namespace std; int main() { bool done = false; char selection; cout << "Welcome to TrustUs Savings and Loan:" << endl; cout << "Where you money is as safe as you think it is." << endl; while (!done) { cout << "Please select from the following menu options: " << endl; cout << "1. Deposit Money" << endl; cout << "2. Withdraw Money" << endl; cout << "3. View Account Info" << endl; cout << "4. Exit" << endl; cout << "Please enter a selection: "; cin.get(selection); cin.ignore(); switch (selection) { case 1: // deposit. break; case 2: // withdraw break; case 3: // view account balance. break; case 4: done = true; break; default: cout << "Invalid selection. Please enter 1-4." << endl; } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!