subject

Create a Java project called Padlock. java with the given information 1. public Padlock​(int n1,
int n2,
int n3)
Constructs a padlock with the given combination. This constructor does NOT verify that the given combination is valid, in the sense described above. A lock with an invalid combination will still behave according to this specification in every respect; however it may be impossible to unlock it following the steps in the package directions.
Initially, the lock is open and the dial is at 0, disc 2 is at TOOTH degrees rotation, and disc 1 is at 2 * TOOTH degrees rotation, regardless of the given combination.
2. public void randomizePositions​(java. util. Random rand)
Set the three discs to random, valid positions.
3. public void setPositions​(int n1, int n2, int n3)
Sets the positions of the three discs to given angles, as closely as possible while ensuring the positions are valid. Disc 3 is always set to the given angle n3. If the given angle n2 is within n3 plus or minus the tooth width, then the disc 2 position will be set to n3 + the tooth width. Similarly, if n1 is within the new disc 2 position plus or minus the tooth width, then disc 1 will be set to the new disc 2 position + the tooth width. All values will be normalized to be between 0 and 359, inclusive.
4. public void turnLeftTo​(int number)
Turns the dial (disc 3) counterclockwise until its position is the given number.
5. public void turnRightTo​(int number)
Turns the dial (disc 3) clockwise until its position is the given number.
6. public void turn​(int degrees)
Turns the dial (disc 3) the given number of degrees, where a positive number represents a counterclockwise rotation and a negative number represents a clockwise rotation.
7. public int getDiscPosition​(int which)
Returns the current position of the given disc (1, 2, or 3, where disc 3 is the front disc attached to the dial). The value returned is always normalized to be between 0 and 359, inclusive. If the argument is not equal to 1, 2, or 3, the method returns -1.
8. public boolean isAligned()
Returns true if all three discs are aligned, that is, for all discs the current position is equal to the offset.
9. public void open()
Opens the lock, if possible. Does nothing unless isAligned is true.
10. public void close()
Closes the lock, whether or not the discs are aligned.
11. public boolean isOpen()
Determines whether the lock is currently open.
12. public static final int TOOTH
Width of the teeth on each disc in the mechanism, expressed in degrees of rotation.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:40, genyjoannerubiera
Kali, a python programmer, is using the turtle module to write the word “hello.” which code should she use to indicate the location to begin writing the word? a # pick up the turtle and move it to its starting location. b penup(-100, 200) goto() pendown() c penup() goto(-100, 200) pendown() d # pick up the turtle and move it to (-100, 200)
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, mjweed2456
Nathan wants to create multiple worksheet containing common formatting styles for his team members. which file extension him to save these worksheets? nathan to create multiple worksheets with common styles. he needs to save them with the extension.
Answers: 1
image
Computers and Technology, 24.06.2019 00:30, sethhdoty
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. obfuscate: to make something so confusing that it is difficult to understand.
Answers: 2
image
Computers and Technology, 24.06.2019 00:50, anthonycraig0205
3. what is the output of the following statements? temporary object1; temporary object2("rectangle", 8.5, 5); temporary object3("circle", 6, 0); temporary object4("cylinder", 6, 3.5); cout < < fixed < < showpoint < < setprecision(2); object1.print(); object2.print(); object3.print(); object4.print(); object1.set("sphere", 4.5, 0); object1.print();
Answers: 1
You know the right answer?
Create a Java project called Padlock. java with the given information 1. public Padlock​(int n1,

Questions in other subjects: