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
Best free vpn to bypass geo tagging
Mamont248 [21]

Answer:

Nord VPN

Explanation:

5 0
4 years ago
Differentiate between inherited trait and acquired trait​
miskamm [114]

Answer: Inherited trait is something you already have and acquired is something that you learn or achieve.

Explanation:

8 0
3 years ago
What will be a fundamental aspect of future games??
alina1380 [7]
I believe that the answer to the question provided above is that with the age of improving technology, the aspects of future games will be based more unto electronic games or e-games.
Hope my answer would be a great help for you.    If you have more questions feel free to ask here at Brainly.
7 0
3 years ago
Read 2 more answers
. Which one of the following is not a typical engine cylinder arrangement? A. V-type B. Dome-type C. In-line D. Horizontally opp
Tomtit [17]
The answer would be B. Dome-Type. V-Type engines are some of the most common, with abbreviations such as V6, V8, etc. In-Line engines are where the cylinders are in a straight line. Horizontally opposed engines or 'flat' engines are where the cylinders are on a flat plane. Therefore the only type of engine *configuration* is B. Dome-Type.

Dome-type relates to the cylinder design, where the piston has a convex dome to maximize the efficiency.

Hope this helps.
4 0
3 years ago
What is the principal goal of data science?<br>​
Rama09 [41]

Answer:

The goal of data science is to construct the means for extracting business-focused insights from data

7 0
3 years ago
Other questions:
  • Which method of deleting files can be used in windows xp and vista?
    12·1 answer
  • You have created shared folders for all your companies departments and assigned the appropriate permissions. everyone can access
    8·1 answer
  • (a) [5 pts] Suppose you purchase a wireless router and connect it to your cable modem. Also suppose that your ISP dynamically as
    13·1 answer
  • Imagine a typical website that works as a storefront for a business, allowing customers to browse goods online, place orders, re
    13·1 answer
  • Draw a flowchart diagram for a program that displays numbers 1 to 20
    12·1 answer
  • Draw a chart showing the crossing between red and white flowered pea plants till F2 generation. Find out the genotypic and pheno
    6·1 answer
  • Create a class called StockTester that has the following fucntionality. a. Create a main method with an ArrayList named dataStoc
    9·1 answer
  • What is the best description of an unbound control?
    12·1 answer
  • Electronic data interchange (EDI) and electronic funds transfer (EFT) are forms of__________e-commerce transactions.
    13·1 answer
  • What are web site and web page?​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!