Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ #include using namespace std ; class BankAccount{ private : int ID; string Firstname; string Surname; char Acc_type; float Acc_balance; static int TotalNumberofAcc ;//static

image text in transcribed

using c++

#include using namespace std ;

class BankAccount{ private : int ID; string Firstname; string Surname; char Acc_type; float Acc_balance; static int TotalNumberofAcc ;//static

public : BankAccount(); BankAccount(int ID,string Firstname,string Surname,char Acc_type,float Acc_balance); BankAccount(Const BankAccount& b); void setID(int); void setFirstname(string); void setSurname(string); void setAcc_type(char); void setAcc_balance(float);

int getID(); string getFirstname(); string getSurname(); char getAcc_type(); float getAcc_balance(); void print(); void Deposit(float d); bool Withdraw(float w); float enquiry(); void HolderName(); void DispNumAcc(); ~BankAccount();

};

Using the class 'BankAccount' defined in the assignment 2, modify it according to the following: 1. Remove data member Bank Account Type (Current Account, Savings Account)" from the BankAccount class. 2. Modify the parameterized constructor to take balance as argument. 3. Add copy contractor. B) Create an inheritance hierarchy where BankAccount" is the base class and "SavingAccount" and "CurrentAccount" are derived classes. With the SavingAccount, the Bank pays interest 4% each Year to the customer based on the account balance. With the CurrentAccount, the Bank subtracts 1 JD as charges for each withdraw transaction. 1. Initialise a SavingAccount and CurrentAccount objects with an initial balance 100JD. 2. Write the code of 'Calculate Interest' function for the SavingAccount class. It should calculate the interest yearly and add it to the balance. 3. Write the code of 'TransactionCharge function for the Current Account class. It should deduct 1JD from the balance after each withdraws transaction. 4. Create a "Flexy Account" class that drived from SavingAccount and CurrentAccount. 5. create CalculateInterest' function for the Flexy Account class, knowing that the interest rate is 1%. 6. create TransactionCharge function for the Flexy Account class, knowing that the charge for each withdraw transaction is 0.5 JD. 7. Write the appropriate code for the destructor of each derived class. 8. Write the code of PrintBank' function for each derived class. C) Write a program (main) that will do the following: 1. create a BankAccount' object with 1000 JD in Balance. 2. create a SavingAccount object with 400 JD in Balance. 3. create a CurrentAccount object with 2000 JD in Balance. 4. display the balance of SavingAccount object after one year, using PrintBank function. 5. display the balance of CurrentAccount object after 10 withdraw transactions, , using PrintBank function. 6. create a Flexy Account object with 800 JD in Balance. 7. create a Flexy Account object using a copy constructor. 8. display the balance of Flexy Account object after 5 withdraw transactions performed during the last 3 months, , using PrintBank function. Note that you should separate the interface form the implementation for all of your code

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

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

Find P(x52) for a binomial random variable with n510 and p5.1.

Answered: 1 week ago