This exercise focuses on creating a class that contains a collection of functions that can be used without an instance object of the class to exist. Present both the class and the main program that helps you to test all members’ class function.
Define a class named Utility to incorporate the following static functions. The developer must provide the definition of the functions by defining the proper formal parameters and return value. The following utility member functions should be implemented in the Utility class:
This exercise emphasizes the development of designing a C++ class. Attention would be given in the way the member variables and member functions are grouped together and are grouped under different access levels, as well as the signature of functions.
Write a C++ class “Account” to model a bank account and save the class definition in the Account.h file and the class implementation in Account.cpp file. The bank account class should have the following class members visible only to the member functions:
All the above class members must be initialized when the customer opens the account using the constructor of the class in the main program. For each transaction (deposit and withdraw) the Number of transactions should be incremented by one.
The following member functions would be provided in order to support transactions with the bank account:
You must define the type of the member variables and the right signature (type of the parameters and return type of a function) of the member functions. The “DepositAmt” and “WithdrawAmt” functions would return the final balance. You need to pass as parameter the amount you deposit or withdraw respectively.
Error checking and handling would be appreciated for a withdraw exceeding the balance and a return error should be return in this case through the return of the function.
Have the program display to the standard output the account’s statement as below when accessing the PrintStatement member function:
First Name : John
Last Name : Doe
SIN : 111-222-333
Account Type : Checking
Total Transactions: 13
Final Balance : 1200
Preprocessor definitions statements must be used to guarantee the uniqueness of the inclusion of the header file.
The main program should: