Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Banking Program Create two classes to model bank accounts: SavingsAccount and CheckingAccount. CheckingAccount is derived from SavingsAccount. Both have the following private data members:

C++ Banking Program

Create two classes to model bank accounts: SavingsAccount and CheckingAccount. CheckingAccount is derived from SavingsAccount. Both have the following private data members:

string account_number //only set by constructor

double balance // balance in account, cannot be negative

Both account have the following functions:

void set_balance(double b) // sets balance

int get_balance() const //returns balance

string get_account_number() // returns the account_number

void deposit(double amount) // adds amount to the balance

void withdrawal(double amount) // withdraws from the amount from balance, cannot go into negative

string a_to_string() // returns the account_number and balance labeled as a string

SavingsAccount has a constructor that accepts the account_number and balance

CheckingAccount inherits all of this from SavingsAccount and has the following:

double transaction_fee //private and can't be negative

void set_transaction_fee(double fee) // set the transaction fee

double get_transaction_fee() // returns transaction_fee

The following functions are modified in CheckingAccount:

void deposit(double amounts) // subtracts transaction_fee from balance after making deposit

void withdrawal(double amount) // subtracts the transaction_fee from balance after making withdrawal

string a_to_string() // returns account number, balance, and transaction_fee labeled as a string

CheckingAccount has a constructor the accepts the account_number, balance, and transaction_fee

The deposit, withdrawal, and a_to_string functions are virtual

Test these classes by creating at least two objects of each in the main and demonstrate that the functions work properly when the objects are being pointed to by a SavingsAccount pointer.

Split the code up into SavingAccount.h, SavingAccount.cpp, CheckingAccount.h, CheckingAccount.cpp, SavingAccount.h, and main.cpp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are the key forces limiting profits in your industry?

Answered: 1 week ago

Question

What can you do to avoid having this bill passed in 2 0 2 2 ?

Answered: 1 week ago

Question

Define Conventional Marketing.

Answered: 1 week ago

Question

Define Synchro Marketing.

Answered: 1 week ago

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago