Question
Please use C++ for this problem. Please refer to the sample as how the output should look. Define a class named Money that stores a
Please use C++ for this problem. Please refer to the sample as how the output should look.
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. Add accessor and mutator functions to read and set both member variables. Add another function that returns the monetary amount as a double. In main(), test the implementation of your class with two different Money objects. Ask the user to enter values for dollars and cents and then display the value as a double. Sample: MONEYOBJECT1: Enterthedollarvalueasaninteger:-2 Enterapositivevalue:2 Enterthecentsvalueasaninteger:0 Moneyobject1asadouble:$2 MONEYOBJECT2: Enterthedollarvalueasaninteger:100 Enterthecentsvalueasaninteger:107 Enteravaluebetween0and99:99 Moneyobject2asadouble:$100.99
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started