Using C++ Define the class Account, which is an abstraction of a bank account Solution

Using C++ programming language: //Define the class Account, which is an abstraction of a bank account. The Account class must have two private data members: account number and account balance. Supply a default constructor that sets both balance and account number to zero. Include a second constructor with two parameters to initialize the balance and the account number. The class should have methods for withdraw, deposit and request balance. A fee of $10 must be charged if an attempt is made to withdraw more money than available in the balance. Include in the class a print method that prints the account number and the current balance. To test the Account class write a main function in which you create two objects of the type Account.
void withdraw(double amount);
void deposit (double amount);
Test both objects for withdraw and deposit then call the print method of each of the objects.

//Write another main function – in this function create three bank accounts, then prompt the user to enter a bank account number, if the account number matches one on the three accounts then display the following menu otherwise allow the user to enter another account number (this is very similar to the last assignment, except that you are working with objects rather than function calls)
1. Show Balance
2. Make a withdraw
3. Make a Deposit
4. Exit

//Include a non-member function to transfer funds between accounts:
void transfer( Account & from, Account &to, double amount )
The method transfer will deduct amount from the account “from” and adds the same amount to the account “to” given there is enough funds; otherwise it will display the message “insufficient fund”. Test the function transfer in the main program.
Powered by