Define a class for a type called Counter . An object of this type is used to count things. Include a default constructor that sets the counter to zero and a constructor with one argument that sets the counter to the value specified by its argument. Write member functions to increase the value by one (called increment ) and decrease the value by one (called decrement ), don’t let the value go below 0. Write a member function ( print ) that prints out the value of the counter. *The first photo is the driver program that you should include to test your class ****The second is what
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Define a class for a type called Counter . An object of this type is used to count things. Include a default constructor that sets the counter to zero and a constructor with one argument that sets the counter to the value specified by its argument. Write member functions to increase the value by one (called increment ) and decrease the value by one (called decrement ), don’t let the value go below 0. Write a member function ( print ) that prints out the value of the counter.
*The first photo is the driver program that you should include to test your class
****The second is what the program should look like****
![39
Bint main()
{
Counter c1;
Counter c2(10);
40
41
42
43
44
cout « "C1 starts at ";
c1.print();
cout <« endl;
45
46
47
48
cl.increment();
49
cl.increment();
50
cout « "C1 now at ";
c1.print();
cout <« endl;
51
52
53
54
55
с1 с2;
56
c1. decrement();
57
58
cout <« "C1 now at ";
cl.print();
cout « endl;
59
60
61
62
63
return 0;
64](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5bd3697d-7244-4dc8-845a-c06954fa71b0%2F9e4c6529-413d-4573-83a6-c16e7f09166a%2Fqnpin3_processed.png&w=3840&q=75)
![(mingli@polaris:~/TA]$ ./labl2
ci starts at 0
Ci now at2
Cl now at 9
[mingli@polaris:~/TA]$ |](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5bd3697d-7244-4dc8-845a-c06954fa71b0%2F9e4c6529-413d-4573-83a6-c16e7f09166a%2Ftr822e_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)