Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using C++ language to create the program. Create an Account class that a bank mi

ID: 3637886 • Letter: U

Question

Using C++ language to create the program.


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. The Constructor should validate the initial balance to ensure that it's greater than or equal to zero. If not, set the balance to 0 and display error message indicating that the initial balance was invalid. 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 getBalnce should return the current balance. Create a program that creates two Account objects and tests the member functions of class Account.

I HELP WITH THIS QUESTION AS SOON AS POSSIBLE!! PLEASE, PLEASE.

Explanation / Answer

// Account.cpp // Member-function definition for class Account. #include using namespace std; class Account { public: Account(int); // contructor initializes balance void credit(int); // add an amount to the account balance void debit(int); int getBalance(); // return the account balance int getDebit(); private: int balance; // data member tha stores the blance }; // end class account // Account constructor initializes data member balance Account::Account(int initialBalance) { balance=0; // assume that the blance ebgins at 0 // if initialBalance is greater than 0, set this value as the // balance of the Account; otherwise, balance remains 0 if( initialBalance > 0 ) balance = initialBalance; // if initialBlance is negative, print error message if( initialBalance < 0 ) cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote