/* Define a class called Counter. An object of this class is used to count things, so it records a count that is a nonnegative whole number. Include methods to: set the counter to zero, to increase the count by 1, and to decrease the count by 1. Be sure that no method allows the value of the counter to become negative. Also, include an accessor method that returns the current count value. Also, include a method that outputs the count to the screen. There will be no input method. The only method that can set the counter is the one that sets it to zero. Also, write a program to test your class definition. */ import CSLib.*; public class Counter { //Data private int count; //Constructors public Counter() { count = 0; } public Counter (int k) { count = k; } //Accessor public int getCount() { return count; } //Mutators public void setZero () { count = 0; } public void addOne () { count++; } public void minusOne () { if (count > 0) count--; } public void display () { OutputBox out = new OutputBox(); out.println ("Counter = " + count); } }