An odometer records a car’s mileage. It contains a number of counters that increment as the car travels. Each counter shows a digit from 0 to 9. The rightmost counter increments the fastest, increasing by 1 for every mile traveled. Once a counter reaches 9, it changes to 0 on the next mile and increases by 1 the value on the counter to its left. You can generalize the behavior of such digit counters by giving them symbols other than the digits from 0 to 9. Examples of such digit counters include the following:
• A binary odometer whose counters each show either 0 or 1
• A desktop date display with three counters, one each for the year, month, and day
• A dice roll display whose counters each show the spots for a single die
Write a Java interface for any class that represents a digit counter. Also, write a Java interface for a general counter that has up to four digit counters. Include comments in javadoc style.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here