Question: Using c++ Please make sure the code looks exactly the same as the sample when it is run. Implement a class for a type called

Using c++ Please make sure the code looks exactly the same as the sample when it is run.

Implement a class for a type called CounterType. An object of this type is used to count things, so it records a count that is a nonnegative whole number. Include the following functions in your class: - a member mutator function that sets the counter to a number given as an argument - a member function that increases the count by 1 - a member function that decreases the count by 1 if it does not result in count becoming negative - a member function that returns the current value of count - a member function that prints the current value of count to standard output Write a test program for your class in main(). Your program should prompt the user to enter a positive value to initialize the CounterType object, then subtract 1 from the object and print out the current value, add 1 to count and print out the current value, and print out the final value.

Using c++ Please make sure the code looks exactly the same asthe sample when it is run. Implement a class for a typecalled CounterType. An object of this type is used to count things,

WORK AREA RESULTS a member function that returns the current value of count -a member function that prints the current value of count to standard outout Write a test program for your class in main). Your program should prompt the user to enter a positive value to initialize the CounterType obiect, then subtract 1 from the object and print out the current value, add 1 to count and print out the current value, and print out the final value. SAMPLE RUN # 1: ./CounterType Interactive SessonShow Invisibles Highlight: None # 1 Show Highlighted Only Enter a number to start with:10 The value after subtracting 1: 9 The value after adding 1: 10 Final valuei 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!