The basic outline of a keypad lock is as follows. At any given moment, such a lock is either open or closed. It has a keypad on which there are keys for each of the decimal digits 0 through 9, as well as keys for open and close functions. Pressing the close key causes the lock to become (or remain) closed. Pressing the open key causes a lock to become open, assuming that the digits entered most recently (via the keypad) correspond to its code. (A lock that is already open is not affected by the open being pressed.)
The description above leaves open several details about how a keypad lock behaves. Among the questions it leaves unanswered are these:
Your assignment is to complete the development of a class, called KeyPadLock. Missing from the class are the bodies of the (public) methods. Some declarations of fields (i.e., instance variables) are present, but you may wish to add more. You may also add private methods, if you see fit.
Regarding the questions raised above, some of them are answered in the post-conditions of the class's methods while others are answered implicily by virtue of which methods appear (or fail to appear) in the class. For example, the question of whether a lock's code can be changed is answered in the negative by virtue of the fact that there is no method whose invocation could possibly cause such a change.
Here is an application, called KeyPadLockDriver, that should help you in testing your KeyPadLock class. Notice that its main() method creates a new instance of KeyPadLock and allows the user to simulate the pushing of keypad buttons by entering characters on the keyboard. This method expects a string of digits to be supplied to it via a "command line argument". To achieve this using jGrasp, click on the Build item in the menu bar, which will have the effect of displaying a menu of items. Click on the Run Arguments item (so as to place a check mark in the corresponding box). This will cause a Run Arguments text box to appear at the top of the current class's window. (When you do this, the current class should be KeyPadLockDriver.) Then type in the desired values for the "command line arguments" (here, a sequence of digits indicating the "secret" code for opening the keypad lock) and click on the appropriate icon to run the program.
E-mail your completed source code (i.e., the KeyPadLock.java file, not the corresponding .class file) to mccloske@cs.uofs.edu. Remember to include a comment that lists the names of all persons who assisted you in completing the assignment. Also, if you are aware that your class does not meet all its specifications, include a comment listing those it fails to meet.