Skip to content

Commit b4cdc4c

Browse files
Update P03_ManOWar.java
1 parent ed148f7 commit b4cdc4c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ExamsExercises/MidExams_06/P03_ManOWar.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ public static void main(String[] args) {
99
int[] pirateShip = Arrays.stream(scanner.nextLine().split(">"))
1010
.mapToInt(Integer::parseInt)
1111
.toArray();
12+
1213
int[] warShip = Arrays.stream(scanner.nextLine().split(">"))
1314
.mapToInt(Integer::parseInt)
1415
.toArray();
16+
1517
int maxHealth = Integer.parseInt(scanner.nextLine());
1618
String commandLine = scanner.nextLine();
1719
boolean end = false;
20+
1821
while (!commandLine.equals("Retire") && !(end)) {
1922
String command = commandLine.split(" ")[0];
2023
if (command.equals("Status")) {
@@ -69,6 +72,7 @@ public static void main(String[] args) {
6972
commandLine = scanner.nextLine();
7073
}
7174
}
75+
7276
if (!end){
7377
System.out.printf("Pirate ship status: %d%n", getStatus(pirateShip));
7478
System.out.printf("Warship status: %d%n", getStatus(warShip));

0 commit comments

Comments
 (0)