Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Java file names: Problem4.java and Problem4Tester.java Problem 5. (20 points) Write a Java class comboLock that works like the combination lock in a gym locker.
Java file names: Problem4.java and Problem4Tester.java Problem 5. (20 points) Write a Java class comboLock that works like the combination lock in a gym locker. The lock is constructed with a combination, three numbers between o and 39. The reset method resets the dial so that it points to O. The turnLeft and turnRight methods turn 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. The class and its methods' signatures are as follows: public class ComboLock public ComboLock (int secretl, int secret2, int secret3) t . . . 1 public void turniettint ticka) public void turnLeft (int ticks) t.. . ) public void turnRight (int ticks) . . public boolean open) ( . .. ) Also, provide a tester class, comboLockTester, that tests the above class using various combinations entered by a user inside a loop. User will exit from the loop by entering three Os as the combination
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started