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
If you're connected to a switch and your NIC is in promiscuous mode, what traffic would you be able to capture
Yuri [45]

If you're connected to a switch and your NIC is in promiscuous mode, the traffic would you be able to capture would be broadcast traffic.

<h3>What is Broadcast traffic?</h3>

Broadcast traffic is used to send packets to all hosts on the network using the network's broadcast address. With a broadcast, the packet contains a destination IP address that only has numbers one (1s) in the host portion. This means that all hosts on that local network (broadcast domain) will receive and verify the packet. Many network protocols, such as DHCP, use broadcasts. When a host receives a packet sent to the network's broadcast address, the host processes the packet as a packet addressed to its unicast address.

Also, there are two types of broadcasts: directed broadcast and limited broadcast.

See more about computing at: brainly.com/question/10873104

#SPJ1

8 0
2 years ago
2.2 Write an interactive C# program that asks the user to input an integer number. The program checks whether the number entered
AlexFokin [52]

Answer:

I need some time i answering your question please follow me and thanks

6 0
3 years ago
Memory containing hardwired instructions that the computer uses when it boots up, before the system loads. In PCs the instructio
VladimirAG [237]

Answer:

<h2>Rom</h2>

Explanation:

ROM is memory containing hardwired instructions that the computer uses when it boots up, before the system software loads

4 0
3 years ago
Read 2 more answers
In Python which is the correct method to load a module math?
Wittaler [7]

Answer: The math module is a standard module in Python and is always available. To use mathematical functions under this module, you have to import the module using import math .

Explanation:

3 0
3 years ago
When driving, your attention is __________.
maks197457 [2]
It is c hope I helped
7 0
3 years ago
Read 2 more answers
Other questions:
  • What are the advantages of homogenation
    5·1 answer
  • What is the order in which windows systems receiving and process multiple gpos?
    7·1 answer
  • Where should you click to edit an existing formula?
    12·2 answers
  • An organization is building a new customer services team, and the manager needs to keep the tream focused on customer issues and
    13·1 answer
  • Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a
    8·1 answer
  • Complete the below method, isPalindrome(), that takes in a String and returns a boolean. The boolean should be true if the Strin
    7·1 answer
  • When discussing the business requirements of a WLAN design, what is the first question that should be posed
    15·1 answer
  • Public class Main{ public static void main(String [] args){ String name=WelcomeJava; Runnable r1=() -&gt; System.out.println(nam
    12·1 answer
  • Which list shows a correct order of mathematical operations that would be used by a spreadsheet formula?
    5·2 answers
  • Question #5
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!