Assignment 2
Assignment 2
Banking System
Instructions:
You are tasked with developing a simple banking system program in C++ that allows users to create bank
accounts, deposit and withdraw funds, check balances, and perform other operations. Your program
should incorporate the following features:
1. BankAccount Class:
The BankAccount class represents individual bank accounts and should have private
member variables for account number, balance, and owner's name.
Implement constructors to initialize the account with default values and with user-
defined values. Ensure proper initialization of member variables using constructor
initializer lists.
2. Transactions:
Implement methods to deposit and withdraw funds from the account. Ensure that
withdrawal is only allowed if the balance is sufficient.
Introduce a static attribute to keep track of the total number of accounts created.
Implement a static method to calculate and return the average balance across all
accounts.
4. Operator Overloading:
5. Friend Function:
The user will interact with the program via a simple command-line interface.
Users can choose from various operations such as creating an account, depositing funds,
withdrawing funds, checking balance, and displaying account details.
Output:
The program should provide appropriate messages to inform the user about the outcome of
each operation (e.g., success or failure).
Display account information, transaction history, and average balance as requested by the user.
Example:
1. Create Account
2. Deposit Funds
3. Withdraw Funds
4. Check Balance
6. Exit
Insufficient balance!
Balance: $500
Account Details:
Balance: $500
Transaction History:
1. Deposit: +$500
Total Transactions: 1