File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/ExamsExercises/MidExams_06 Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments