(AccountClass) Create a class calledAccount that a bank might use to represent c
ID: 3612873 • Letter: #
Question
(AccountClass)
Create a class calledAccount that a bank might use to represent customers' bankaccounts. Your class should include one data member of type int torepresent the account balance. [Note: In subsequent chapters,we'll use numbers that contain decimal points (e.g., 2.75)calledfloating-point values to represent dollar amounts.] Your classshould provide a constructor that receives an initial balance anduses it to initialize the data member. The constructor shouldvalidate the initial balance to ensure that it is greater than orequal to 0. If not, the balance should be set to 0 and theconstructor should display an error message, indicating that theinitial balance was invalid. The class should provide three memberfunctions. Member function credit should add an amount to thecurrent balance. Member function debit should withdraw money fromthe Account and should ensure that the debit amount does not exceedthe Account's balance. If it does, the balance should be leftunchanged and the function should print a message indicating "Debitamount exceeded account balance." Member function getBalance shouldreturn the current balance. Create a program that creates twoAccount objects and tests the member functions of classAccount.
Explanation / Answer
please rate - thanks #include using namespace std; class Account{private: int balance; public: Account(int val) {if(valRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.