0
Can anyone solve this problem please🙏?
You are an administrator at a football club who must categorize already played games on the team's website. The given program takes 3 inputs: 1. match status - which checks if the match is suspended ("true") or not suspended ("false") 2. your team's score 3. opposing team's score. Complete the program so that if the match is suspended (the 1st input is "true"), it will output "Suspended". If the match is not suspended ( the1st output is false), the following statuses should be set depending on the match result: "Won", "Lost" and "Draw
7 Réponses
+ 2
the description field has truncated the problem requirement... and maybe your code attempt: nobody will give you a code if you do not provide your own attempt ;P
we could help, but we are not free code providers ^^
+ 2
you doesnt need the 'if (true)' / 'if (false)': the former will be executed, abd the later not...
rather, you should only keep the 'if (isSuspended == true)' wich check the equality (return true or false), and execute the block quote if equality is true...
so in the block you must have only thr 'Suspended' output.
for the second part you must use 'else' with a new block, in wich you test the score and output the related result ^^
+ 1
why downvoting my answers if it was helpful?
why not set the best answer mark on the most helpful post?
+ 1
It's my mistake. Sorry for that.
0
Actually idon’t know.here's my attempt
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();
if(isSuspended == true){
if(true){
System.out.println("Suspended");
}
if(false){
if(ourScore > theirScore ){
System.out.println("Won");
}
else if(ourScore < theirScore ){
System.out.println("Lost");
}
else
System.out.println("Draw");
}
}
}
0
Thank you so much 🥰
0
you may also remove the downvote on my first post, and set the best answer mark on the second rather than the first ;)