Skip to content

Commit f8518d0

Browse files
Update P02_TreasureHunt3.java
1 parent eafd29b commit f8518d0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ExamsExercises/MidExams_06/P02_TreasureHunt3.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class P02_TreasureHunt3 {
99
public static void main(String[] args) {
1010
Scanner scanner = new Scanner(System.in);
1111
List<String> treasureChests = Arrays.stream(scanner.nextLine()
12-
.split("\\|"))
13-
.collect(Collectors.toList());
12+
.split("\\|"))
13+
.collect(Collectors.toList());
14+
1415
String commandLine = scanner.nextLine();
16+
1517
while (!commandLine.equals("Yohoho!")) {
1618
String command = commandLine.split(" ")[0];
1719
switch (command) {
@@ -24,7 +26,6 @@ public static void main(String[] args) {
2426
}
2527

2628
}
27-
2829
break;
2930
case "Drop":
3031
int index = Integer.parseInt(commandLine.split(" ")[1]);
@@ -56,6 +57,7 @@ public static void main(String[] args) {
5657

5758
commandLine = scanner.nextLine();
5859
}
60+
5961
if (treasureChests.isEmpty()) {
6062
System.out.println("Failed treasure hunt.");
6163
} else {

0 commit comments

Comments
 (0)