Question: Java Help! P8.1 Declare a class ComboLock that works like the combination lock Here is sample output of an interaction with the program. shere the

Java Help!

Java Help! P8.1 Declare a class ComboLock that works like the combination

P8.1 Declare a class ComboLock that works like the combination lock Here is sample output of an interaction with the program. shere the clocument ocker, as shown here. The lock is constructed with Please enter 3 values for the new combo lock: 121212 a combination - three numbers between 0 and 39 . 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 Combo is: 121212 left or right. The open method attempts to open the lock. The lock Current Number: 0 Enter number of ticks to turn to the right 040. Enter an invalid number to quit (negative, or >40 ). 28 Current Number: 12 Enter number of ticks to turn to the left 040. Enter an invalid number to quit (negative, or >40 ). 40 Current Number: 12 Enter number of ticks to turn to the right 0 - 40 . Enter an invalid number to quit (negative, or >40 ). 40. You opened the lock! Designing Classes Would you like to run simulation again? (Yes or No) 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. Please enter 3 values for the new combo lock: 121314 public class ComboLock Combo is: 121314 \{ Current Number: 0 Enter number of ticks to turn to the right 040. Enter an invalid number to quit (negative, or >40 ). public ComboLock(int secret 1 , int secret 2 , int secret 3){} 28 public void reset (){. Current Number: 12 public void turnLeft(int ticks) {. public void turnRight(int ticks) {} Enter number of ticks to turn to the left 040. Enter an invalid number to quit (negative, or >40 ). public boolean open() {. \} Current Number: 13 Enter number of ticks to turn to the right 0=40. Enter an invalid number to quit (negative, or >40 ). 39 You opened the lock! Would you like to run simulation again? (Yes or No) y Please enter 3 values for the new combo lock: 123

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!