In the slides and textbook, one of the examples features a class for counting up. An interface which defines this functionality is given below: public interface IncrementCounter { //Increments the...


In the slides and textbook, one of the examples features a class for counting up. An interface which defines this functionality is given below:


public interface
IncrementCounter

{


//Increments the counter by one.


void
increment
();


//Returns the number of increments since creation.


int
tally
();


//Returns a string representation that counts number of increments and the ID of the counter.


String
toString();


}



Write
a class that implements this interface while not using any number type member variables (e.g., int, float, Integer, etc). Also do not use a variable that stores the number as a plain string (i.e., "123"). The class should be named AnotherCounter and have a constructor that takes a String parameter to store as an ID.

Nov 20, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here