PROGRAMMING LANGUAGE: C++ I need the code for counterType.h , counterTypelmp.cpp , main.cpp MAIN.CPP code provided in this exercise [EVALUATE THE GIVEN CODE AND PROVIDE THE CORRECT CODE] //Main program #include #include "counterType.h" using namespace std; int main() { counterType counter1; counterType counter2(5); counter1.print(); cout << endl; counter1.incrementCounter(); cout << "After Increment counter1: " << counter1.getCounter() << endl; cout << "Counter2 = " << counter2.getCounter() << endl; counter2.decrementCounter(); cout << "After decrement counter2 = " << counter2.getCounter() << endl; counter1.setCounter(-6); cout << "After resetting counter1: " << counter1.getCounter() << endl; return 0; } // ** I WILL DEFINITELY RATE AND GIVE THUMBS UP, IF THE THREE CODES ARE PROVIDED AND THE EXERCISE IS SATISFIED. ** //
I need the code for counterType.h , counterTypelmp.cpp , main.cpp
MAIN.CPP code provided in this exercise [EVALUATE THE GIVEN CODE AND PROVIDE THE CORRECT CODE]
//Main program
#include <iostream>
#include "counterType.h"
using namespace std;
int main()
{
counterType counter1;
counterType counter2(5);
counter1.print();
cout << endl;
counter1.incrementCounter();
cout << "After Increment counter1: " << counter1.getCounter() << endl;
cout << "Counter2 = " << counter2.getCounter() << endl;
counter2.decrementCounter();
cout << "After decrement counter2 = " << counter2.getCounter() << endl;
counter1.setCounter(-6);
cout << "After resetting counter1: " << counter1.getCounter() << endl;
return 0;
}
// ** I WILL DEFINITELY RATE AND GIVE THUMBS UP, IF THE THREE CODES ARE PROVIDED AND THE EXERCISE IS SATISFIED. ** //
![counterType.h
counterTypelmp.cpp
main.cpp](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F834d07ed-5215-4056-adc1-0886987cfc4f%2F906ae731-607e-4fa8-9405-53b2737b0ff4%2Ffpx50dp_processed.jpeg&w=3840&q=75)
![Instructions
Define a class counterType to implement a
counter. Your class must have a private data
member counter of type int . Define a
constructor that accepts a parameter of type int
and initializes the counter data member. Add
functions to:
• Set counter to the integer value specified by
the user.
Initialize counter to 0.
• Return the value of counter with a function
named getCounter.
• Increment and decrement counter by one.
• Print the value of counter using the print
function.
• Example output: Counter = 0.
The value of counter must be nonnegative.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F834d07ed-5215-4056-adc1-0886987cfc4f%2F906ae731-607e-4fa8-9405-53b2737b0ff4%2Fwb1i3ck_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 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)