Question: Class Account{Public:Account( Int ); // Constructor Initializes Balancevoid Credit( Int ); // Add An Amount To The Account Balancevoid Debit( Int ); // Subtract An

Class Account{Public:Account( Int ); // Constructor Initializes Balancevoid Credit( Int ); // Add An Amount To The Account Balancevoid Debit( Int ); // Subtract An Amount From The Account Balanceint GetBalance(); // Return The Account Balanceprivate:int Balance; // Data Member That Stores The Balance}; // End Class AccountCreate An Account Class That A Bank

class Account { public: Account( int ); // constructor initializes balance void credit( int ); // add an amount to the account balance void debit( int ); // subtract an amount from the account balance int getBalance(); // return the account balance private: int balance; // data member that stores the balance }; // end class Account Create an Account class that a bank might use to represent customers bank accounts. Include a data member of type int to represent the account balance. Provide a constructor that receives an initial balance and uses it to initialize the data member. Provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money from the Account. Member function getBalance should return the current balance. Create a program that creates two Account objects and tests the member functions of class Account.

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 Programming Questions!