Declare a class ComboLock that works like the combination lock in a school or gym locker…..

Declare a class ComboLock that works like the
combination lock in a school or gym locker..
The lock is constructed with a combination dial numbers between
0 and 39.

The constructor sets the three “secret” numbers and the current
position to 0.
The reset method resets the dial so that it
points to 0.
The turnLeft and turnRight
methods turn the dial by a given number of ticks to the left or
right.
The open method attempts to open the lock. The
lock opens if the user first turned it right to the first number in
the combination, then left to the second, and then right to the
third. If the lock doesn’t open, the lock is reset.
The toString method should show current
position of the lock’s dial
The getSolution method should return a
String with the three “secret” numbers separated
by spaces.
The equals method should compare the three
“secret” numbers of two locks (one the calling object, the other a
parameter ComboLock object).

Here are the headings of the methods that should be included in
your ComboLock class for this lab:
public class ComboLock {
. . .
public ComboLock(int secret1, int secret2, int secret3) { … }
public void reset() { … }
public void turnLeft(int ticks) { … }
public void turnRight(int ticks) { … }
public boolean open() { … }
public String toString() { … }
public String getSolution() { … }
public boolean equals(ComboLock another){ … }
}

You will need to determine the properties required to track the
state of a ComboLock and how close a combination
is to opening the lock.
Please remember to document your constants and methods using
Javadoc-style comments and tags. Spend some time making your
documentation useful, thorough, and easy to understand.
In a separate class, create a main method to
test your class. Initialize a new ComboLock with
combination 15 – 28 – 4. Demonstrate your
ComboLock class by showing the results of the
following attempts to open the lock:

right 14, left 20 (34 ticks), right 4 (24 ticks)
left 15, right 28, left 4
right 15, left 28, right 8
right 15, left 28
right 15, left 28 (27 ticks), right 4 (16 ticks) – opens

Create another ComboLock object with a
combination of your choice and demonstrate how it works, as
well.
Finally compare the two locks using the equals
method.