Question: C++ 5. Create a class named AccountInfo that has: - 2 private fields named accountNo and checking. They represent the account number, the amount of
C++
5. Create a class named AccountInfo that has: - 2 private fields named accountNo and checking. They represent the account number, the amount of money in a checking account. - 3 constructors - the first constructor has no parameters, and initializes two private fields with specific values when it is called. For example, initializing accountNo to 1234, and checking to 2000. - the second constructor has one parameter. When it is called, it initializes checking to a specific value, for example initializing checking to 2000. The field accountNo is initialized by "pass-by-value". That is, it is initialized by the parameter of the constructor. - the third constructor has two parameters. When it is called, it initializes accountNo and checking by "pass-by-value". That is, they are initialized by the parameters of the constructor. - 2 private methods - the first one is named WidthDrawCh that has one parameter representing the amount of money withdrawn from a checking account. When it is called, it will "withdraw" money from the checking account. - the second one is named DepositCh that has one parameter representing the amount of money added to a checking account. When it is called, it will "add" money to the checking account. - 1 public method - it is named ShowAccountInfo. When it is called, it will print the values of accountNo and checking. - 4 public methods as wrapper methods - the first one will return the value of accountNo when it is called. - the second one will return the value of checking when it is called. - the third one will deposit money to the account when it is called. - the fourth one will withdraw money from the account when it is called. - the main method - in this method, it calls each constructor to create an instance of this class. Then, call each method above.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
