In this activity, you will be mimicking the structure and functionality of a combination lock using a set of classes.
Combination Lock Interface (ICombinationLock.java)
Co-Construct Interface based on other requirements
Communication Marks [10] - For quality of participation in interface construction (individual)
Thinking [5] - For quality of interface constructed (group)
[2017-2018 S2 ICombinationLock.java]
Combination Lock Class (CombinationLock.java)
A combination lock must satisfy the following conditions, by implementing variables and/or methods as necessity dictates:
Instance/Static Variables - Knowledge [10]
- Specified max value of each combination digit
- Specified minimum value of each combination digit
- Three + digits of combination
- Physical lock health (for breaking the lock)
- Pick the lock
- State of unlockedness
- Administrative password
- Value representing whether the lock is broken or not
- Proper encapsulation of variables
Methods - Application [38]:
Non-Admin Methods
- Minimum 2 constructors (Default and Set Combination) [2]
- Getters and Setters of appropriate fields only [2]
- Lock the lock - Returns or outputs confirmation that the lock is locked, or that the lock was already locked [3]
- A method that receives a three-digit combination from a user and opens the lock if the combination is correct. [5]
- A method that lowers the lock's health if called (i.e. someone is trying to break/smash the lock) [2]
- A method that attempts to pick the lock if called [2]
- A method that checks the lock's health level. If the lock's health is zero, it is unlocked, but all other functionality is disabled until it is reset. [2]
- A method that tracks the number of attempts that have been made to open the lock using the combination. [2]
- A method that tracks the number of attempts that have been made to pick the lock [2]
Admin Methods (Require admin password to call)
- A method that attempts to set the combination and checks to see if any digits are outside the min/max values. [3]
- A method that resets the lock's health [2]
- A method that outputs the combination [2]
- A method that changes the combination (randomly?) [2]
- A method that changes the minimum and maximum values of the combination (with proper error handling) [3]
- A method to change the admin password [2]
- toString() [2]
- Save and Load functions [6 - Bonus] - Bonus marks will not count above 100%
LockClient.java (Client Program) - Knowledge [20]
The client should be a "menu" style program that presents a list of options to the user. There should be a non-admin menu section and a password-protected admin section. The menu options should be relisted after every action until an exit option is selected.
Before the menu is displayed, a combination lock object is generate using a random, 3-digit code. The password is also set. Please use your name as the password by default.
Non-Admin Options:
- Enter Admin Section
- Check Lock status
- Attempt to open the lock with a 3-digit code
- Attempt to pick the lock
- Check the lock's health
- Attempt to break the lock physically (If the lock is smashed, all other functions are disabled until reset by the admin)
- Brute force attack (All possible combos). After the combination is found, output the number of attempts.
- Exit
Admin Options:
- See the lock combination
- Reset the lock's health
- Change the min/max values
- Change the combination
- Change the password
- Accesses the toString() method
- Save Method [Bonus]
- Load Method [Bonus]
LockTestHarness.java - Thinking [20]
A full test harness is necessary to test all functions of CombinationLock.java. Only black-box tests are necessary.
JavaDoc - Communication [30]
All methods in the interface must have full JavaDoc