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
Ad libitum [116K]
3 years ago
14

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

imit of type int. A static int variable named nCounters which is initialized to 0. A constructor taking two int parameters that assigns the first one to counter and the second one to limit. It also adds one to the static variable nCounters. A method named increment. It does not take parameters or return a value; if the instance variable counter is less than limit, increment just adds one to the instance variable counter. A method named decrement that also doesn't take parameters or return a value; if counter is greater than zero, it just subtracts one from the counter. A method named getValue that returns the value of the instance variable counter. A static method named getNCounters that returns the value of the static variable nCounters.
Computers and Technology
1 answer:
viktelen [127]3 years ago
5 0

Answer:

see explaination

Explanation:

public class Counter

{ int counter,limit;

static int nCounters = 0;

Counter(int a,int b)

{ counter=a; limit=b;

nCounters++;

}

void increment()

{ if(counter<limit)

counter++;

}

void decrement()

{ if(counter>0)

counter--;

}

private int getValue()

{ return counter;

}

private static int getNCounters()

{ return nCounters;

}

}

You might be interested in
Please Help!! Digital Information Technology Class!!
Rama09 [41]
It’s probably GUI??.
6 0
3 years ago
Read 2 more answers
IS ANYONE ELSE JUST GETTING PPL PUTTING LINKS WHEN U ASK A QUESTION???
TiliK225 [7]
UGH IKR, LIKE JUST ANSWER THE FRICKIN QUESTION
4 0
2 years ago
Read 2 more answers
Rachel wants to minimize project risks. Arrange the steps in an order that will correctly help Rachel and her team to minimize p
Thepotemich [5.8K]
Identify, evaluate, prioritize, and then control
8 0
3 years ago
Read 2 more answers
A network system administrator would typically be responsible for which of the following duties?
EleoNora [17]

Answer:

A) Maintaining the shared connections between offices

Explanation:

Plz mark brainliest

3 0
3 years ago
Read 2 more answers
What is the function of a slide transition in a presentation program? A. It enables you to change the presentation layouts. B. I
Lelechka [254]

The answer would be

C. It adds visual effects when you move from one slide to another.

Hope this has helped you! :)

5 0
3 years ago
Read 2 more answers
Other questions:
  • Windows Live SkyDrive is an example of _____ storage.
    13·1 answer
  • What is zenmap typically used for? how is it related to nmap? describe a scenario in which you would use this type of applicatio
    14·1 answer
  • What Word feature is seen below?
    10·1 answer
  • A browser allows you to set preferences for using the browser. These preferences include all of the following except
    7·1 answer
  • In Windows 7's Jump List, what can we do?
    6·1 answer
  • 3. Create mode was one of the most innovative and influential features of which of the following games?
    7·1 answer
  • What is 3x10? PLZZZZZ
    11·1 answer
  • Who know's web Design
    12·1 answer
  • 8.6 Code Practice: Question 2
    7·1 answer
  • Which of the following offers more reliable antivirus protection? Question 43 options: A) antivirus software on user PCs B) anti
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!