CMPS 144 Fall 2019
Prog. Assg. #1: Reversible Counter
Due: 11:59pm, Friday, Sept. 20

Specification

Provided are several Java classes in the "counter class hierarchy" that was the subject of recent lectures and lab:

Each class in this list is a child of the one above it (except for Counter of course, which sits at the top of the hierarchy).

For this assignment, you are to complete the development of ReversibleCounter, which is to be a sibling of RollOverCounter.

The comments already appearing in the class should be sufficient to describe the intended behavior of instances of the class. Several methods have been marked as being STUBs, meaning that code needs to be supplied for them to work as intended. Also, it may be necessary to insert declarations of instance variables and/or class constants.

The application ReversibleTester can be used for testing your work. An example of a user/program dialog resulting from its use is shown below. (That dialog is consistent with a ReversibleCounter object that is behaving correctly.)


Program Submission

Use the file submission system (see the link near the top of the CMPS 144 course web page) to submit your completed ReversibleCounter.java file into the prog1_dir folder. Make sure to complete the comments appearing near the top of the source code file that has been provided. In particular, you should insert your name and list the names of anyone who aided/collaborated with you in doing the work. Also, you are to describe any behavioral defects that your class has (e.g., characterizations of test cases that it fails). If there are defects of which you are unaware, it probably means that you did a poor job of testing your work. Thus, of two submissions having similar defects, one in which those defects are acknowledged deserves a better grade than one in which they are not acknowledged.


Dialog with ReversibleTester

Creating a new ReversibleCounter object...
Enter minimum of range: 0
Enter maximum of range: 4
Enter initial count value: 2
Initially:
count val = 2; mode = Standard; min = 0; max = 4

q to quit, i to increment, d to decrement,
s  to setTo, t to toggle mode, h for this help

>i
After incrementing:
count val = 3; mode = Standard; min = 0; max = 4

>i
After incrementing:
count val = 4; mode = Standard; min = 0; max = 4

>i
After incrementing:
count val = 4; mode = Reverse; min = 0; max = 4

>i
After incrementing:
count val = 3; mode = Reverse; min = 0; max = 4

>i
After incrementing:
count val = 2; mode = Reverse; min = 0; max = 4

>i
After incrementing:
count val = 1; mode = Reverse; min = 0; max = 4

>i
After incrementing:
count val = 0; mode = Reverse; min = 0; max = 4

>i
After incrementing:
count val = 0; mode = Standard; min = 0; max = 4

>i
After incrementing:
count val = 1; mode = Standard; min = 0; max = 4

>d
After decrementing:
count val = 0; mode = Standard; min = 0; max = 4

>d
After decrementing:
count val = 0; mode = Reverse; min = 0; max = 4

>i
After incrementing:
count val = 0; mode = Standard; min = 0; max = 4

>i
After incrementing:
count val = 1; mode = Standard; min = 0; max = 4

>i
After incrementing:
count val = 2; mode = Standard; min = 0; max = 4

>t
After toggling the mode:
count val = 2; mode = Reverse; min = 0; max = 4

>i
After incrementing:
count val = 1; mode = Reverse; min = 0; max = 4

>d
After decrementing:
count val = 2; mode = Reverse; min = 0; max = 4

>q