Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

m Your department has the highest absenteeism in 199-.

Answered: 1 week ago