Question: In C++, write a class definition for a BankAccount class that contains the following members: Member variables account ID (of the form xxxxx-xxxxx, where x
In C++, write a class definition for a BankAccount class that contains the following members:
Member variables
account ID (of the form xxxxx-xxxxx, where x is a digit)
account holder name (e.g. John Joe)
account balance
Member methods
Initialize(ID, name, balance): sets the account ID to a given ID, the account holder name to the given string, and account balance to a given number
SetHolderName(name): sets the account holder name to the given name
IncreaseBalance(amount): increases balance by the given amount
DecreaseBalance(amount): if the given amount is no more than the balance, remove it from the balance and return true; otherwise, return false
Deactivate: deactivates the account by setting the account ID to 00000-00000, holder name to the empty string, and balance to 0
IsActive: returns true if the account is active and false otherwise (an account is inactive if the account ID is 00000-00000 and the holder name is the empty string
Print: displays the state of the account (values of the member variables in an organized format)
GetID: gets the account ID
GetHolderName: gets the account holder name
GetBalance: gets the account balance
Implement all class member functions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
