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
Lorico [155]
3 years ago
13

Write the definition of a class Counter containing: An instance variable named counter of type int. An instance variable named c

ounterID of type int. A static int variable nCounters which is initialized to zero. A constructor that takes an int argument and assigns its value to counter. It also adds one to the static variable nCounters and assigns the result to the instance variable counterID. A method named increment. It does not take parameters or return a value; it just adds one to the instance variable counter. A method named decrement that also doesn't take parameters or return a value; it just subtracts one from the counter. A method named getValue. It returns the value of the instance variable counter. A method named getCounterID: it returns the value of the instance variable counterID.
Computers and Technology
1 answer:
polet [3.4K]3 years ago
4 0
<h2>The definition of a class Counter </h2>

class Counter

{  

Private :                        //access modifier

int counter;                  //defining and initialising variables

int counterID;

static int nCounters=0;

Public :                               //access modifier

Counter(int a)                     //defining functions

{

counter=a;                 //initialising variable counter with argument a          

nCounters++;                   //incrementing 1 to variable nCounters

}

void increment()

{

counter=counter + 1;

}

void decrement()

{

counter=counter - 1;

}

int getValue()

{

return counter;          //returning integer value contained in counter

}

int getCounterID()

{

return counterID;     //returning integer value contained in counter


}

};       //class definition ends





You might be interested in
How long is the bachelor's program at Eth Zurich? 3 or 4 years?
natulia [17]
The bachelor's program at Eth Zurich is 3 years.
I hope this helps!
:-)
4 0
3 years ago
To prevent long page load times for pages containing images, it is best to use a compressed file format such as JPG, as well as
valkas [14]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The given options to this question are:

  1. resolution.
  2. magnification.
  3. orientation.
  4. colors.

The correct option to this question is 1. i.e.

Resolution.

The resolution of an image determines how many pixels per inch an image contains. Image having a higher resolution takes long page load times for a page and lower resolution takes less page load time. So, to prevent long page load times for pages containing images, it is best to use compressed file formation as well as appropriate image dimension and resolution.

While other options are not correct because:

Magnification, orientation, and color does not affect the page load time. Page load time for images only affected by the dimension and resolution of the images.

7 0
3 years ago
You _____ a worksheet to emphasize certain entries and make the worksheet easier to read and understand. a.save b.print c.format
choli [55]
You format a worksheet to emphasize certain entries and make the worksheet easier to read and understand.
6 0
3 years ago
Plz help me I need help​
Digiron [165]

Answer:

ok i will help you

you can asked

8 0
3 years ago
Match the instruments with their uses.
Aneli [31]
Microscope - 1
Telescope - 2
Ruler - 3
Streak plate - 4

7 0
3 years ago
Read 2 more answers
Other questions:
  • What are the two components that make up the chipset?
    15·1 answer
  • What is the impedance mismatch problem? Which of the three programming
    10·1 answer
  • which software is used to mimic intricate hand drawings into digital paintings? _____ is used to replicate hand drawings into di
    7·1 answer
  • What is a limitation of the flash memory card select one of the options below as your answer:
    6·1 answer
  • RFID tags uses memory that is read-only.A. TrueB. False
    5·1 answer
  • Before you give your presentation to an audience, you should make sure that your ideas are organized in a clear and meaningful w
    8·2 answers
  • Write a program that rolls two dice until the user gets snake eyes. You should use a loop and a half to do this. Each round you
    10·1 answer
  • Someone help meeeeeeeee plz.......................
    11·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    13·1 answer
  • What is the action of extracting data fragments and then reassembling them in order to recover a file?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!