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 interfaceIncrementCounter{
//Increments the counter by one.
voidincrement();
//Returns the number of increments since creation.
inttally();
//Returns a string representation that counts number of increments and the ID of the counter.
StringtoString();
}
Writea 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.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here