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
Assume you're using a three button mouse. To connect shortcut menus, you would what
Grace [21]
You would click the right button to a shortcuts

5 0
3 years ago
Write the prototype for a function named showSeatingChart that will accept the following two-dimensional array as an argument. c
barxatty [35]

Answer:

See explaination

Explanation:

void showSeatingChart(string seatingChart[20][40], const int ROWS, const int COLS){

for(int i = 0;i<ROWS;i++){

for(int j = 0;j<COLS;j++){

cout<<seatingChart[i][j]<<" ";

}

cout<<endl;

}

}

4 0
3 years ago
What format are a setups program file in before executed?
UkoKoshka [18]
.EXE as they are executable programs.  However, it depends on the operating system
6 0
3 years ago
What is the primary difference between sort and filter?
Over [174]

Answer:

all the questions that she is submitting is all the questions im getting wrong please someone answer them for me please help me out

Explanation:

im not that smart and i need help please someone

8 0
3 years ago
Read 2 more answers
Write a statement that defines an ifstream object named inputFile and opens a file named "Friends.txt".
Simora [160]

Answer:

ifstream inputFile;

inputFile.open("Friends.txt");

Explanation:

Though, the programming language is not stated, questions like this are often from C++.

The first statement defines the ifstream object using the following syntax.

ifstream [object_name]

In this case, the object name is inputFile

So, the syntax becomes

ifstream inputFile;

The next line opens a file using the following syntax.

[object_name].open("Filename")

Here, object_name is inputFile and filename is Friends.txt

So, the open statement becomes

inputFile.open("Friends.txt")

5 0
3 years ago
Other questions:
  • Write a program that estimates the approximate number of times the user’s heart has beat in his/her lifetime using an average he
    12·1 answer
  • Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE p
    8·1 answer
  • Blender questions
    8·1 answer
  • which one of these steps describe saving a newly created file. click on the save icon. minimize the file. name the file. select
    12·2 answers
  • Clusters always occur in multiples of what? <br> A.)10 <br> B.)5<br> C.)2 <br> D.)100
    10·2 answers
  • A thin red border indicates the active cell. (True or False)
    12·1 answer
  • Boardman College maintains two files—one for Sociology majors and another for Anthropology majors. Each file contains students'
    5·1 answer
  • State the functions of all the parts of the computer​
    14·1 answer
  • Who is the fan of Techno gamerz and Total gaming
    10·1 answer
  • Which best describes what databases do?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!