C++ Help Pls Define a class named Money that stores a monetary amount. The class
ID: 3691736 • Letter: C
Question
C++ Help Pls
Define a class named Money that stores a monetary amount. The class should have two private integer variables, one to store the number of dollars and another to store the number of cents. Include a default constructor that initializes the amount to $0.00 and an overloaded parameterized constructor to initialize any non-zero amount.
Add accessor member functions: getDollars( ) getCents( )
Add mutator member functions: setDollars( )setCents( )
Add a condition to your setCents() mutator that will update the dollars member if the cents input argument is 100 or larger.
Add another member function named getAmount() that returns the monetary amount as a single double number.
Write a main() program that tests all of your member functions with at least two different Money objects
Explanation / Answer
Hi below i have written a sample code for your reference, Hope so you understand all the methods :)
class .h file
cpp file for function implementation
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.