Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Combinatorial Testing In Cloud Computing

Authors: Wei-Tek Tsai ,Guanqiu Qi

1st Edition

9811044805, 978-9811044809

Students also viewed these Programming questions