1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
seraphim [82]
4 years ago
6

My programming lab 9.2 C++ Write a full class definition for a class named Counter, and containing the following members:_______

.
A) A data member counter of type int.
B) A constructor that takes one int argument and assigns its value to counter
C) A function called increment that accepts no parameters and returns no value.
D) Increment adds one to the counter data member.
E) A function called decrement that accepts no parameters and returns no value.
F) Decrement subtracts one from the counter data member.
G) A function called getValue that accepts no parameters.
H) It returns the value of the instance variable counter.
Computers and Technology
1 answer:
cupoosta [38]4 years ago
8 0

Answer:

class Counter {    

 public:

   int counter;

   Counter(int counter) {     // Constructor

     counter = counter;

   }

   void increment(){

      counter++;

  }

 

   void decrement(){

      counter--;

   }

    int getValue(){

       return counter;

   }

};

<h2><u>Explanation:</u></h2>

// Class header definition for Counter class

class Counter {    

// Write access modifiers for the properties(data members) and methods

 public:

  //a. Create data member counter of type int

   int counter;

   //b. Create a constructor that takes one int argument and assigns

   // its value to counter.

   Counter(int counter) {     // Constructor  with argument counter

    counter = counter;         // Assign the argument counter to the data

                                              // member counter

   }

   // c. Create a function increment that accepts no parameters

   // and returns no value (i.e void)

   void increment(){

      counter++;   // d. increment adds one to the counter data member

  }

 

   // e. Create a function decrement that accepts no parameters

   // and returns no value (i.e void)

   void decrement(){

      counter--;   // f. decrement subtracts one from the counter data member

   }

   // g. Create a function called getValue that accepts no parameters.

   // The return type is int, since the data member to be returned is of

   // type int.

    int getValue(){

       return counter; // h. it returns the value of the instance var counter

   }

}; // End of class declaration

Hope this helps!

You might be interested in
You are creating a presentation and you have come to the last slide. you still have more information to add. what should you do?
ohaa [14]
If you are using Google Slides, Click the plus arrow in the top left hand corner of the webpage. That will add another slide to the presentation you are working on
7 0
3 years ago
Read 2 more answers
Ms office suite comes with its own set of pictures in the​
goldfiish [28.3K]

Answer:

clipart ...........................

Explanation:

clipart is the correct answer for the above question.

6 0
3 years ago
Jeremy is the team leader of the employees planning to display the company’s new product at a big convention. He needs to be sur
Luden [163]
Assuming no options are provided, Jeremy would do well to create a weekly progress report, detailing what the company has accomplished during the week, and what remains to be accomplished. The report should be goal-based with defined deadlines, and clear explanations on what has been done and what remains to be done, and should be organized by the various aspects of the project (accounting, marketing, etc). This report will help keep his team conscience of their role within the larger project, what they have accomplished thus far, and what still needs to be done.
6 0
3 years ago
Read 2 more answers
what are the two capabilities of the internet that promote and sustain customer relationships? multiple choice question. anywher
nika2105 [10]

The two capabilities of the internet that promote and sustain customer relationships is option C: interactivity and individuality.

<h3>What can the internet do and how does it function?</h3>

A global computer network called the internet transmits many types of data and media between linked devices. It functions by utilizing a packet-routing network that complies with Transport Control Protocol (TCP) and Internet Protocol (IP).

Therefore, Note that Web interactivity describes interactive elements that are integrated into websites and allow for the exchange of information between users of technology or between users of communication technology.

Learn more about internet  from

brainly.com/question/2780939
#SPJ1

5 0
2 years ago
What is life all about?
zloy xaker [14]
Life can be about anything........
8 0
3 years ago
Read 2 more answers
Other questions:
  • In a pinhole camera, the image seen in the camera will be inverted<br><br> true<br> false
    13·2 answers
  • In the web address www.microsoft, the "" is the _____ meaning _____. A. B. C. D. Group of answer choices top-level domain (TLD);
    6·1 answer
  • Assume the list numbers1 has 100 elements, and numbers2 is an empty list. Write code that copies the values in numbers1 to numbe
    15·1 answer
  • As your textbook explains, Wikipedia is usually the only source you need when
    8·1 answer
  • In which situations would it be most helpful to filter a form? Check all that apply.
    8·1 answer
  • Help meee pleaseeee
    5·1 answer
  • Explain the importance of system software in the computer​
    8·1 answer
  • Queues can be represented using linear arrays and have the variable REAR that point to the position from where insertions can be
    12·1 answer
  • To remove a specified number of characters from anywhere within a string, you should use the ____ method.
    15·1 answer
  • This was the template given for my assignment: class Login:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!