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
Evgesh-ka [11]
4 years ago
7

Write a full class definition for a class named Counter, and containing the following members: A data member counter of type int

. A data member named limit of type int. A static int data member named nCounters which is initialized to 0. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit. It also adds one to the static variable nCounters A member function called increment that accepts no parameters and returns no value. If the data member counter is less than limit, increment just adds one to the instance variable counter. A member function called decrement that accepts no parameters and returns no value. If counter is greater than zero, decrement subtracts one from the counter. A member function called getValue that accepts no parameters. It returns the value of the instance variable counter. A static function named getNCounters that accepts no parameters and returns an int. getNCounters returns the value of the static variable nCounters.
Computers and Technology
1 answer:
vfiekz [6]4 years ago
4 0

// making the class

class Counter {

int counter;

int limit;

// Constructor

Counter(int a, int b){

counter = a;

limit = b;

}

// static function to increment

static increment(){

if(counter<limit)

nCounter+=1;

}

// Decrement function

void decrement(){

if(counter>0)

nCounter-=1;

}

int getValue(){

return counter;

}

static int nCounter;

int getNCounters(){

return nCounter;

}

};

// Initializa the static

int Counter::nCounter = 0;

You might be interested in
What are some of the challenges that could arise from setting up a file management system on a computer?
erastovalidia [21]
One challenge is that arranging things in simple folders creates a limited structure that obstructs the way that would perfectly suit your needs. Any information that is dependent on those folders can easily get lost by removing as much as a simple image from that folder, in the events that the information is dependent on the folder structure.
7 0
3 years ago
The printer prints 16 pages every minute. How many pages are printed in 6 minutes?
Olenka [21]

Answer:

96 pages are printed in 6 minutes

7 0
3 years ago
Read 2 more answers
Which of the following statements best reflects the difference between Warner Brothers and MGM?
schepotkina [342]

Answer:

MGM started in film production, while Warner Bros started in distribution.

Explanation:

Metro-Goldwyn-Mayer Studios Inc or MGM was founded in 1924 for Marcus Loew, located at 245 North Beverly Drive in Beverly Hills, California, this company produce feature films and television programs.

Warner Bros. Entertainment Inc was founded in 1923 for Harry, Albert, Sam, and Jack Warner, this company has operations in areas such as film, television, and video games, In 1918 they opened the first Warner Brothers Studio on Sunset Boulevard in Hollywood. Handled finance and distribution in New York City. During World War I their first nationally syndicated film, My Four Years in Germany.

7 0
3 years ago
What is the difference between coding with html and coding with python
dsp73

Answer:

Python is an object-oriented programming language that is designed to be accessible and simple for all users, HTML is a web language and is used globally to define the structure of web pages by using various tags. HTML is not a programming language it's a markup language which is used to formatting web pages. Python is a general purpose scripting language which can be used to develop a wide range of programs.

5 0
3 years ago
Select all that apply. How do you save presentations?
Len [333]

Answer:

it's number 3 if I remember for Microsoft Excel

Explanation:

click “File” from the menu in the top left-hand corner of Excel. Then click “Save As

3 0
3 years ago
Other questions:
  • A presentation to sixth graders always should be more abstract than a presentation to corporate executives?
    12·2 answers
  • Section: Friction
    10·1 answer
  • Help me out here pleaseeeee
    9·2 answers
  • Why might a variable used for output have to be of a different type then a variable used for input?​
    15·1 answer
  • What is considered to be the core of the Unix operating system ?
    14·1 answer
  • Storage that is wiped clean when power is cut off from a device is known as _____.
    13·1 answer
  • Hubs hardware advantage's and disadvantages​
    7·1 answer
  • Make a program that receives several integers (the program ends when a negative number is entered) and shows how many times the
    14·1 answer
  • (50 POINTS)
    12·1 answer
  • Type the correct answer in each box. Spell all words correctly, and use numerals instead of words for numbers. If necessary, use
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!