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
____ [38]
3 years ago
9

Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T

he Counter class should contain a single integer as instance data, representing the count. Write a constructor to initialize the count to zero. Write a method called click that increments the count and another method called get Count that returns the current count. Include a method called reset that resets the counter to zero. Finally, create a driver class called CounterTest that creates two Counter objects and tests their methods.
Computers and Technology
1 answer:
Sonja [21]3 years ago
4 0

Answer:

Code is in java

Explanation:

Code is self explanatory, added come comments to explain more about the code.

public class CounterDriver {

   public static void main(String[] args){

       // Creating counter first object

       Counter counter1 = new Counter();

       //performing 2 clicks

       counter1.click();

       counter1.click();

       // displaying counter 1 click count

       System.out.println("Total Number of counter1 clicks :"+counter1.getCount());

       // resetting counter 1 click count

       counter1.reset();

       // again displaying click count which will be 0 after reset

       System.out.println("Total Number of counter1 clicks :"+counter1.getCount());

      // Same operation goes with counter 2  

       // the only difference is that it performs 3 clicks

       Counter counter2 = new Counter();

       counter2.click();

       counter2.click();

       counter2.click();

       System.out.println("Total Number of counter2 clicks :"+counter2.getCount());

       counter2.reset();

       System.out.println("Total Number of counter2 clicks :"+counter2.getCount());

   }

}

class Counter{

   int count;

// defining constructor which will initialize count variable to 0

   public Counter(){

       this.count=0;

   }

// adding click method to increment count whenever it's called

   public void click(){

       this.count++;

   }

// getCount method will return total count

   public int getCount(){

       return this.count;

   }

// reset method will set count to 0

   public void reset(){

       this.count = 0;

   }

}

You might be interested in
Since nobody answered, I'm gonna just try this again. I really need help with this so please-
pantera1 [17]

Answer:

3.8

Explanation:

5 0
3 years ago
When several computers connected to the Internet have been set up to forward spam and sometimes viruses to other computers on th
balu736 [363]

Answer:

Option D: Botnet

is the correct answer.

<h3>When several computers connected to the Internet have been set up to forward spam and sometimes viruses to other computers on the Internet, <u>Botnets </u>are responsible. </h3>

Explanation:

A Botnet can be taken as the combination of two words "robot" and "networks". Botnets are used in depicting the malicious content as the breach the network security. They are used for stealing data by Distributed Denial of Service attack (DDoS) and by sending spam to all other devices connected to a network. All this scheme is managed by the attacker itself.

All other listed options spread malicious data by some other means.

I hope it will help you!

4 0
3 years ago
Read Chapter 2 in your text before attempting this project. An employee is paid at a rate of $16.78 per hour for the first 40 ho
Vitek1552 [10]

Answer:

Answered below

Explanation:

#Answer is written in Python programming language

hrs = int(input("Enter hours worked for the week: "))

dep = int(input ("Enter number of dependants: "))

pay = 16.78

ovpay = pay * 1.5

if hrs <= 40:

wage = hrs * pay

else:

wage = hrs * ovpay

ss = wage * 0.06

fedtax = wage * 0.14

statetax = wage * 0.05

dues = 10

if dep >= 3:

ins = 35

net_pay = wage - ss - fedtax - statetax - dues - ins

print(wage)

print ( ss, fedtax, statetax, dues, ins)

print (net_pay)

8 0
3 years ago
Mr. Green maintains a spreadsheet containing data on all of his employees, including name, job profile, monthly salary, and home
marta [7]
The answer is C because he'll be able to search up the employees name then it will tell him all the information he needs along with their job profile
6 0
4 years ago
What is a characteristic ofa good cloud-based hosting?
Aliun [14]

Answer:

Explanation:

A good cloud-based hosting has many beneficial characteristics, some of which include on-demand self-service, broad network access, and being very elastic and scalable. These characteristics allow for a large number of users to benefit from the service at any time of the day and at a very fast speed due to the broad network access.

6 0
3 years ago
Other questions:
  • Steps needed to deposit cash on cash deposit machine
    6·1 answer
  • Database management systems _____. a. include transaction-processing reports for database analysis b. are used to create, organi
    6·1 answer
  • As the project manager for a software development project, you are helping to develop the project schedule. You decide that writ
    13·1 answer
  • Other side for bullying
    7·1 answer
  • A programmer is writing a system that is intended to be able to store large amounts of personal data. As the programmer develops
    11·1 answer
  • Electronic cover letters are longer than traditional paper cover letters.
    13·2 answers
  • Is this a desktop or a computer, or are they the same thing
    12·1 answer
  • An engine that generates hot, expanding gases by burning fuel inside the machine.
    9·1 answer
  • TensorFlow and Pytorch are examples of which type of machine learning platform?
    11·1 answer
  • _______ refers to the use of gps or rfid technology to create virtual boundaries that enable software to trigger a response when
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!