Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hey everyone, I need help with the following program. Define a class for a type

ID: 3616401 • Letter: H

Question

Hey everyone, I need help with the following program.
 Define 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 a
mutator function that sets the counter to a count given as an argument. Include
member functions to increase the count by one and to decrease the count by one.
Be sure that no member function allows the value of the counter to become negative.
Also, include a member function that returns the current count value and one that
outputs the count. In your test program, increment your counter to 10 and then
decrement down to 5 and display its values after each step

I have implemented class but I am not sure on how to approach the problem. I am posting my work below.

/*
Define 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 a
mutator function that sets the counter to a count given as an argument. Include
member functions to increase the count by one and to decrease the count by one.
Be sure that no member function allows the value of the counter to become negative.
Also, include a member function that returns the current count value and one that
outputs the count. In your test program, increment your counter to 10 and then
decrement down to 5 and display its values after each step


#include <iostream>
#include <cstdlib>
using namespace std;
class CounterType
{
public:
void setCount(int c);
void upCount();
void downCount();
int getCount();
private:
int count;
};
int main(){
CounterType counter;

system("pause");
return 0;
}

void CounterType::setCount(int c){
}
void CounterType::upCount(){
}
void CounterType::downCount(){
}


Thanks!!

Explanation / Answer

please rate - thanks #include #include using namespace std; class CounterType { public: CounterType(); void setCount(int ); void upCount(); void downCount(); int getCount(); void printCount(); private: int count; }; int main(){ CounterType counter; int i; for(i=0;i