Question: in c++ need help creating the account class and the functions associated with it. Currency is not held in floating point numbers in commercial programs



in c++ need help creating the account class and the functions associated with it.
Currency is not held in floating point numbers in commercial programs because they are approximations of fractional values and subject to rounding and truncation errors. Instead, currency is usually handled in terms of the smallest value available. In the case of US dollars, this is cents. You are to create a class called Money and a class called Account . The Account class will maintain a current balance, and have methods for making deposits and withdrawals. All transactions with the Account class must utilize the Money class. Money Class This class must store the its value in an integer that holds cents. It must include a constructor that takes dollars and cents (in two different arguments, both integers) a default constructor overloads of all the relational operators (,= !=,==) overloads of the math operators + and - an overload of the stream operator when a deposit or withdrawal is made, an internal boolean flag should be set indicating that the balance needs to be updated o when any method requests the current balance, the balance should be recalculated if the flag is true. Otherwise, the balance should just be returned. This approach allows the system to accept multiple deposits and withdrawals and only recalculate the balance when the balance is requested an overload of the n) { // print something } else // etc. Currency is not held in floating point numbers in commercial programs because they are approximations of fractional values and subject to rounding and truncation errors. Instead, currency is usually handled in terms of the smallest value available. In the case of US dollars, this is cents. You are to create a class called Money and a class called Account . The Account class will maintain a current balance, and have methods for making deposits and withdrawals. All transactions with the Account class must utilize the Money class. Money Class This class must store the its value in an integer that holds cents. It must include a constructor that takes dollars and cents (in two different arguments, both integers) a default constructor overloads of all the relational operators (,= !=,==) overloads of the math operators + and - an overload of the stream operator when a deposit or withdrawal is made, an internal boolean flag should be set indicating that the balance needs to be updated o when any method requests the current balance, the balance should be recalculated if the flag is true. Otherwise, the balance should just be returned. This approach allows the system to accept multiple deposits and withdrawals and only recalculate the balance when the balance is requested an overload of the n) { // print something } else // etc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
