0

Football club game score

This code displays the correct output, but for some reason it doesn't pass the test import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); boolean isSuspended = read.nextBoolean(); int ourScore = read.nextInt(); int theirScore = read.nextInt(); // your code goes here if (isSuspended == true){ System.out.println("Suspended"); } else { System.out.println("false"); } System.out.println(ourScore); System.out.println(theirScore); if (isSuspended != true && ourScore > theirScore){ System.out.println("Won"); } else if (isSuspended == true) { System.out.println("Suspended"); } if (ourScore < theirScore){ System.out.println("Lost"); } else if (ourScore == theirScore){ System.out.println("Draw"); } } }

22nd Oct 2021, 10:49 PM
Natanael
3 Answers
+ 1
I just figured it out, it's supposed to display only "Suspended" if it is suspended.
22nd Oct 2021, 10:56 PM
Natanael
+ 1
tip: if (isSuspended == true){ is same as if (isSuspended) {
23rd Oct 2021, 1:20 AM
zemiak
0
Thanks, it's amazing how that works out that way, similar shortcut like t+=1;
23rd Oct 2021, 4:04 PM
Natanael