Suppose an interface named ICounter is declared. public interface ICounter {void decrement(); int getCount();void increment();void reset();} A class that implements ICounter will have an instance variable which is an int and acts as a counter variable (a counter variable is a variable that is used to count how many times something happens). ICounter declares four methods: When decrement() is called on an object of a class that implements ICounter, the counter instance variable in the object shall be decremented (decrement means to subtract 1 from the counter variable). When getCount() is called on an object of a class that implements ICounter, the value of the counter instance variable shall be returned. When increment() is called on an object of a class that implements ICounter, the counter instance variable in the object shall be incremented (increment means to add 1 to the counter variable). When reset() is called on an object of a class that implements ICounter, the counter instance variable in the object shall be set to 0. Here is a UML class diagram for a class named Counter that implements the ICounter interface. Write the Java code for the Counter class. Solution ICounter.java: public interface ICounter { public void decrement(); public int getCount(); public void increment(); public void reset(); } MainCounter.java: //class implements Icounter class ICounterIMP implements ICounter { //declare counter variable int counter=0; void decrement() //decrement overrided methode { counter--;//decreaments counter } int getCount() //getCount overrided methode { return counter;//returns counter value } void increment() Â Â //increment overrided methode { counter++;//increaments counter } void reset() Â Â //decrement overrided methode { counter=0;//intialize counter to zero } } public class MainCounter { public static void main(String args[]) { ICounterIMP obj=new ICounterIMP();//initialiseintance obj.reset();//call reset methode for(int i=1;i<=5;i++)//simple FOR loop for test interface { if(i%3==0) obj.decrement();//call decreament methode else obj.increment(); } System.out.println(\"counter value is: \"+obj.getCount()); obj.reset(); System.out.println(\"counter value is after reset: \"+obj.getCount()); } } output: counter value is: 4 counter value is after reset: 0 .