Question: using c++ class BankAccount { private: int ID; string Firstname; string Surname; char Acc_type; float Acc_balance; public: BankAccount(); BankAccount(const BankAccount& old); void setID(); int getID();

 using c++ class BankAccount { private: int ID; string Firstname; string

Surname; char Acc_type; float Acc_balance; public: BankAccount(); BankAccount(const BankAccount& old); void setID();

using c++

int getID(); void setFirstname(); string getFirstname(); void setSurname(); string getSurname(); void setAcc_type();

class BankAccount { private: int ID; string Firstname; string Surname; char Acc_type; float Acc_balance; public: BankAccount(); BankAccount(const BankAccount& old); void setID(); int getID(); void setFirstname(); string getFirstname(); void setSurname(); string getSurname(); void setAcc_type(); char getAcc_type(); void setAcc_balance(); float getAcc_balance(); void print(); void Deposit(float a); bool Withdraw(float a); float enquiry(); void HolderName(); ~BankAccount(); };

Using the class 'BankAccount defined in the assignment1, modify it according to the following: 1. Add a private static integer data member named "TotalNumberOfAcc" that must be: Incremented whenever a new Bank account object is created. Decremented whenever a Bank account is destroyed. 2. Replace the "Create" function by a parameterised constructor (use this pointer). Given the class Bank below: class Bank { private: int BankID; string BankName; BankAccount *AccBanks ; public: Bank(); Bank(); void AddAcc(); // to add new account to the array of accounts void DeleteAce() // to Delete new account to the array of accounts void PrintBank(); a) Modify the class according to the following: 1. Initialise a Bank object with an array of 5 Bank accounts. 2. Write the appropriate code for the destructor, 3. Write the code of 'AddAcc' and 'DeleteAcc functions. 4. Write the code of "PrintBank" function using the 'print' function of class BankAccount 5. Write the code of 'Optimization' function to shrink size of array. 6. Implement a friend function DispNumAcc" that display the 'TotalNumberOfAcc data member. b) Write a program (main) that will do the following: 1. Define an array of 3 Banks 2. For each Bank: Fill the BankAccount array from the user until all Bank accounts are full. 3. Print the contents of all Banks to the screen. 4. Create a BankAccount object and read the values from the user to fill it, and add it to the corresponding Bank 5. Let the user enter a first Name' and 'Last name' of the account owner and delete the corresponding BankAccount from the Bank(s). Make sure that the deletion doesn't create a gap in the array of BankAccount 6. Delete any unused memory using 'Optimization' function. 7. Display the Total number of accounts in the screen using 'DispNumAcc" function. Note that you should separate the interface form the implementation for all of your code. class BankAccount { private: int ID; string Firstname; string Surname; char Acc_type; float Acc_balance; public: BankAccount(); BankAccount(const BankAccount& old); void setIDO; int getIDO; void setFirstname(); string getFirstname(); void setSurname(); string getSurname(); void setAcc_type(); char getAcc_type(); void setAcc_balance(); float getAcc_balance(); void print(); void Deposit(float a); bool Withdraw(float a); float enquiryO; void Holder Name(); -BankAccount()

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!