Question: URGENT I NEED TO FIX THESE PROBLEMS IN MY CODE import java.util.Random; public class Padlock { /** * Set of variables for Padlock class */

URGENT I NEED TO FIX THESE PROBLEMS IN MY CODE URGENT I NEED TO FIX THESE PROBLEMS IN MY CODE import java.util.Random;public class Padlock { /** * Set of variables for Padlock class*/ private int discPosition1; private int discPosition2; private int discPosition3; private booleanopen; private boolean close; private int offset1; private int offset2; private int

import java.util.Random;

public class Padlock { /** * Set of variables for Padlock class */ private int discPosition1; private int discPosition2; private int discPosition3; private boolean open; private boolean close; private int offset1; private int offset2; private int offset3; /** * Constant */ public static final int TOOTH = 2; /** * Padlock is set to degrees * @param n1 * @param n2 * @param n3 */ public Padlock(int n1, int n2, int n3) { this.offset1 = n1; this.offset2 = n2; this.offset3 = n3; close = false; discPosition2 = TOOTH; discPosition1 = 2 * TOOTH; } /** * Makes Padlock closed */ public void close() { close = true; } /** * Sets to get discs individually * @param n * @return */ public int getDiscPosition(int n) { switch (n) { case 1: return discPosition1; case 2: return discPosition2; case 3: return discPosition3; default: return -1; } } public boolean isAligned() { int min1 = offset1 - 2 * TOOTH

}

PROBLEM: For Padlock(0, 0, 358), after setPositions (356, 2, 358), isAligned should return true. expected: but was: PROBLEM: Closed Padlock should remain closed if alignment is bad. expected: but was: PROBLEM: After turning new Padlock 10, then -100 degrees, disc 3 position should be 270. expected: but was: but was: PROBLEM: After turning new Padlock -10000 degrees, disc 3 position should be 80. expected: but was: PROBLEM: After setPositions(0, 90, 30) and turn(70), positions should be 0, 102, 100. org.opentest4j. AssertionFailedError: Expected 0 102 100, found 360 90 100. PROBLEM: After setPositions(0, 20, 350) and turn(50), positions should be 0, 42, 40. org.opentest4j. AssertionFailedError: Expected 0 42 40, found 360 20 400. PROBLEM: After setPositions(0, 350, 20) and turn(-40), positions should be 0, 338, 340. org.opentest4j. AssertionFailedError: Expected 0 338 340, found 360 350 -20. PROBLEM: After setPositions (45, 40, 30) and turn(-400), positions should be 45, 348, 350. org.opentest4j. AssertionFailedError: Expected 45 348 350, found 45 40 -370. PROBLEM: After setPositions (10, 40, 30) and turn(-400), positions should be 346, 348, 350. org.opentest4j.AssertionFailedError: Expected 346 348 350, found 10 40 -370. PROBLEM: After turn(10000), positions should be 284, 282, 280. org.opentest4j.AssertionFailedError: Expected 284 282 280, found 4 2 10000. PROBLEM: After turn(-10000), positions should be 76, 78, 80. org.opentest4j. AssertionFailedError: Expected 76 78 80, found 4 2 -10000. PROBLEM: After setPositions (0, 90, 30) and turnLeftTo(100), positions should be 0, 102, 100. org.opentest4j. AssertionFailedError: Expected 0 102 100, found 360 90 100. PROBLEM: After setPositions (0, 20, 350) and turnLeftTo(40), positions should be 0, 42, 40. org.opentest4j. AssertionFailedError: Expected 0 42 40, found 360 20 40. PROBLEM: After setPositions (0, 350, 20) and turnRightTo(340), positions should be 0, 338, 340. org.opentest4j. AssertionFailedError: Expected 0 338 340, found 360 350 340. PROBLEM: After setPositions (10, 40, 30), turn(-360) and turnRightTo(350), positions should be 346, 348, 350. org.opentest4j. AssertionFailedError: Expected 346 348 350, found 10 40 350. PROBLEM: Padlock(10, 20, 30) should open correctly using turn methods. Lock with combination 10, 20, 30 should open when combination is dialed, found positions 328, 293, 30. expected: but was: PROBLEM: Padlock(348, 334, 314) should open correctly using turn-to-number methods. Lock with combination 348, 334, 314 should open when combination is dialed, found positions 204, 232, 314. expected: but was: PROBLEM: Padlock(123, 157, 261) should open correctly using turn-to-number methods. Lock with combination 123, 157, 261 should open when combination is dialed, found positions 295, 69, 261. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 44, 72, 63 should open when combination is dialed, found positions 217, 90, 63. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 103, 221, 354 should open when combination is dialed, found positions 154, 275, 354. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 22, 308, 237 should open when combination is dialed, found positions 268, 330, 237. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 196, 168, 243 should open when combination is dialed, found positions 48, 167, 243. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 191, 70, 278 should open when combination is dialed, found positions 170, 36, 278. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 230, 311, 278 should open when combination is dialed, found positions 276, 256, 278. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 190, 16, 93 should open when combination is dialed, found positions 347, 39, 93. expected: but was: PROBLEM: Padlock(0, 0, 0) should open correctly using turn-to-number methods. Lock with combination 0, 0, 0 should open when combination is dialed, found positions 235, 63, 0. expected: but was: PROBLEM: For Padlock(0, 0, 358), after setPositions (356, 2, 358), isAligned should return true. expected: but was: PROBLEM: Closed Padlock should remain closed if alignment is bad. expected: but was: PROBLEM: After turning new Padlock 10, then -100 degrees, disc 3 position should be 270. expected: but was: but was: PROBLEM: After turning new Padlock -10000 degrees, disc 3 position should be 80. expected: but was: PROBLEM: After setPositions(0, 90, 30) and turn(70), positions should be 0, 102, 100. org.opentest4j. AssertionFailedError: Expected 0 102 100, found 360 90 100. PROBLEM: After setPositions(0, 20, 350) and turn(50), positions should be 0, 42, 40. org.opentest4j. AssertionFailedError: Expected 0 42 40, found 360 20 400. PROBLEM: After setPositions(0, 350, 20) and turn(-40), positions should be 0, 338, 340. org.opentest4j. AssertionFailedError: Expected 0 338 340, found 360 350 -20. PROBLEM: After setPositions (45, 40, 30) and turn(-400), positions should be 45, 348, 350. org.opentest4j. AssertionFailedError: Expected 45 348 350, found 45 40 -370. PROBLEM: After setPositions (10, 40, 30) and turn(-400), positions should be 346, 348, 350. org.opentest4j.AssertionFailedError: Expected 346 348 350, found 10 40 -370. PROBLEM: After turn(10000), positions should be 284, 282, 280. org.opentest4j.AssertionFailedError: Expected 284 282 280, found 4 2 10000. PROBLEM: After turn(-10000), positions should be 76, 78, 80. org.opentest4j. AssertionFailedError: Expected 76 78 80, found 4 2 -10000. PROBLEM: After setPositions (0, 90, 30) and turnLeftTo(100), positions should be 0, 102, 100. org.opentest4j. AssertionFailedError: Expected 0 102 100, found 360 90 100. PROBLEM: After setPositions (0, 20, 350) and turnLeftTo(40), positions should be 0, 42, 40. org.opentest4j. AssertionFailedError: Expected 0 42 40, found 360 20 40. PROBLEM: After setPositions (0, 350, 20) and turnRightTo(340), positions should be 0, 338, 340. org.opentest4j. AssertionFailedError: Expected 0 338 340, found 360 350 340. PROBLEM: After setPositions (10, 40, 30), turn(-360) and turnRightTo(350), positions should be 346, 348, 350. org.opentest4j. AssertionFailedError: Expected 346 348 350, found 10 40 350. PROBLEM: Padlock(10, 20, 30) should open correctly using turn methods. Lock with combination 10, 20, 30 should open when combination is dialed, found positions 328, 293, 30. expected: but was: PROBLEM: Padlock(348, 334, 314) should open correctly using turn-to-number methods. Lock with combination 348, 334, 314 should open when combination is dialed, found positions 204, 232, 314. expected: but was: PROBLEM: Padlock(123, 157, 261) should open correctly using turn-to-number methods. Lock with combination 123, 157, 261 should open when combination is dialed, found positions 295, 69, 261. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 44, 72, 63 should open when combination is dialed, found positions 217, 90, 63. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 103, 221, 354 should open when combination is dialed, found positions 154, 275, 354. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 22, 308, 237 should open when combination is dialed, found positions 268, 330, 237. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 196, 168, 243 should open when combination is dialed, found positions 48, 167, 243. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 191, 70, 278 should open when combination is dialed, found positions 170, 36, 278. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 230, 311, 278 should open when combination is dialed, found positions 276, 256, 278. expected: but was: PROBLEM: Randomly created valid Padlock should open correctly using turn-to-number methods. Lock with combination 190, 16, 93 should open when combination is dialed, found positions 347, 39, 93. expected: but was: PROBLEM: Padlock(0, 0, 0) should open correctly using turn-to-number methods. Lock with combination 0, 0, 0 should open when combination is dialed, found positions 235, 63, 0. expected: but was:

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 Finance Questions!