Declare an interface called Incrementable which represents items that store an integer that can be incremented in
Question:
Declare an interface called Incrementable which represents items that store an integer that can be incremented in some way. The interface has a method called increment that increments the value and a method called getValue that returns the value. Once you have written the interface, write two classes called SequentialIncrementer and RandomIncrementer that implement the interface. The SequentialIncrementer begins its value at 0 and increases it by 1 each time it is incremented. The RandomIncrementer begins its value at random integer and changes it to a new random integer each time it is incremented.
Write a client class that creates objects of the two classes and prints out the values before calling the increment method and after calling the method. Call the increment method multiple times and print out the values.
Probability & Statistics for Engineers & Scientists
ISBN: 978-0130415295
7th Edition
Authors: Ronald E. Walpole, Raymond H. Myers, Sharon L. Myers, Keying