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
postnew [5]
3 years ago
9

Write a full class definition for a class named Counter, and containing the following members:________

Computers and Technology
1 answer:
kipiarov [429]3 years ago
3 0

Answer:

The class definition for above problem in java is as follows:-

Explanation:

class Counter // class counter

{

  int counter; // variable counter

  Counter(int v) // construtor

  {

      counter=v;

  }

  void increment() //increment function

  {

      counter=counter+1;

  }

  void decrement() //decrement function

  {

      counter=counter-1;

  }

  int getValue() //getvalue function

  {

      return counter;

  }

}

Code Explanation:

  • The above class definition is in java language.
  • In this code, the name of the class is a Counter and it holds the three functions (increment, decrement and getvalue) and one constructor which is mentioned in the question.
  • To call the above class and their function firstly the user needs to create an object of the counter class in the main function by passing the one integer value on it.
  • The object declaration statement calls the constructor.
  • And then any function can be called by the object of the class with the help of the dot operator.
You might be interested in
You are in charge of an event at work. You want to plan and schedule events and resourse. What type of software should you use?
Sav [38]

project management... we use this software to plan and schedule event and resources.

3 0
3 years ago
Read 2 more answers
A section-lined area is always completely bounded or outlined by an?
Paraphin [41]
Visible outline.
hope this helps
8 0
3 years ago
Which of the following is NOT true about a flow chart?
SCORPION-xisa [38]
I think the answer is A
4 0
3 years ago
Discuss copyright issues as they relate to the Internet, including software piracy and digital rights management, and the Digita
LUCKY_DIMON [66]

To avoid privacy these copyright is been implemented. If copyright is not implemented software company such as Microsoft, Google cannot run the organization so that software has copyright and licenses and they protect from software privacy.

<u>Explanation:</u>

Since the world is digital world all software are available in internet for download and end user will not pay for software and use the software without purchasing from software development industries.

Even software are protected with key, hacker write the tool to brakes the key, so end user easily use these tools and generate the key and user it.

So that software company use Digital millennium copyright act, so that end user can arrested for missing the software’s.

5 0
3 years ago
The incident results in huge losses of revenue as a result their mobile app service is withdrawn. Investigators discovered a vul
zlopas [31]

Answer:

The attackers used the code injection

Explanation:

<em>Because, the HMTL5 allows data and code to be mixed together, making code injection attacks possible. </em>

6 0
3 years ago
Other questions:
  • If a user has just added a simple triangle shape into a diagram, how can the triangle be adjusted? Check all that apply. by maki
    6·2 answers
  • All but one of the following statements about stored procedures is true. Which one is false? a. They consist of one or more SQL
    10·1 answer
  • According to the municipal solid waste report what are the benefits of recycling
    6·1 answer
  • Which of the following is not an element of the modified block style?
    7·2 answers
  • What is the difference between a try block and a try statement? Group of answer choices There is no difference; the terms can be
    6·1 answer
  • What is a system unit
    7·1 answer
  • Brianna is taking a backpacking trip in the wilderness and wants to back up the photos from her camera. Which type of storage de
    10·1 answer
  • How has the widespread shift to remote work caused businesses to reconsider their use of Extended Reality (XR)?.
    13·1 answer
  • YASHARI earns $27,000 per year, is single, and lives in Wyoming. She has $7000 in Direct Subsidized loans and another $19,000 in
    9·1 answer
  • In what way, if any, are problems related to conflicts? Problems and conflicts are the same thing. Problems and conflicts are th
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!