Question: must follow format of 2nd photo. IN JAVA. Create an implementation for the class DoorLock described below. 1. declare an integer constant, called MAX_NUMBER_OF_ATTEMPTS, that


must follow format of 2nd photo.
IN JAVA.
Create an implementation for the class DoorLock described below. 1. declare an integer constant, called MAX_NUMBER_OF_ATTEMPTS, that you will initialize to the value 3 ; 2. instance variables. The class DoorLock must have the necessary instance variables to i. store an object of the class Combination ii. to represent the property of being opened or closed iii. to represent its activation state (the door lock is activated or deactivated), and iv. to count the number of unsuccessful attempts at opening the door; number of failed attempts at opening it should be zero; 4. implement the instance method public boolean isOpen() that returns true if this door lock is currently opened and false otherwise; 5. implement the instance method public boolean isActivated() that returns true if this door lock is currently activated and false otherwise; 7. finally, implement the instance method public boolean open(Combination combination) such that i. an attempt is made at opening this door lock only if this door lock is activated iii. otherwise, i.e. if the wrong Combination was supplied, the number of failed attempts should be incremented by one, iv. if the number of failed attempts reaches MAX_NUMBER_OF_ATTEMPTS, this door lock should be deactivated. Hint: my implementation is approximately 40 lines long, not counting the blank lines
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
