-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLockerDriver.java
More file actions
39 lines (34 loc) · 1.53 KB
/
Copy pathLockerDriver.java
File metadata and controls
39 lines (34 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
public class LockerDriver
{
public static void main(String[] args)
{
Locker locker = new Locker(1337);
System.out.println(locker);
// Test getCombination and nextCombination
System.out.println("Current Combination: " +
locker.getCombination()); // A
locker.nextCombination(); // B
locker.nextCombination(); // C
System.out.println("Current Combination: " +
locker.getCombination()); // C
locker.nextCombination(); // D
locker.nextCombination(); // E
locker.nextCombination(); // A
System.out.println("Current Combination: " +
locker.getCombination()); // A
System.out.println();
// Test getContents
locker.addItem("Water Bottle");
locker.addItem("Math Book");
System.out.println("Contents: " +
locker.getContents()); // Math Book, Water Bottle
locker.addItem("Picture of Mr. Hubbard");
locker.removeItem("Math Book");
locker.removeItem("Picture"); // Doesn't exist
System.out.println("Contents: " +
locker.getContents()); // Picture of Mr. Hubbard, Water Bottle
locker.removeItem("Water Bottle");
System.out.println();
System.out.println(locker);
}
}