0

Can someone help me with this exercise?

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". Sample Input false 3 2 Sample Output Won

23rd Jan 2021, 2:00 PM
Elad David
Elad David - avatar
8 Antworten
0
Hello Elad David Please show us your attempt so that we can help you.
23rd Jan 2021, 5:22 PM
Denise Roßberg
Denise Roßberg - avatar
0
I finaly succeeded on my own... stupid mistakes. thank you anyway 🙏
23rd Jan 2021, 7:38 PM
Elad David
Elad David - avatar
0
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". Sample Input false 3 2 Sample Output Won
7th Mar 2021, 4:51 AM
WILMER MATEO
WILMER MATEO - avatar
0
How???
7th Mar 2021, 4:52 AM
WILMER MATEO
WILMER MATEO - avatar
0
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 == false) {if (ourScore > theirScore) {System.out.println("Won");} if (ourScore < theirScore) {System.out.println("Lost");}else{System.out.println("Draw");}} else // your code goes here {System.out.println("Suspended");} } } Someone please help me out with this, as till case 3 it is all correct and rest 2 are locked. I am unable to rectify an error that why it isn't getting approved by SL
3rd May 2021, 7:56 AM
Swapnil Kamdi
Swapnil Kamdi - avatar
0
Swapnil Kamdi Instead of the first else you need to write if(yourScore == theirScore){ //print Draw}
3rd May 2021, 1:22 PM
Denise Roßberg
Denise Roßberg - avatar
0
Thanks Denise
3rd May 2021, 1:41 PM
Swapnil Kamdi
Swapnil Kamdi - avatar
0
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) System.out.println("suspended"); else if (ourScore > theirScore) System.out.println("won"); else if (ourScore == theirScore) System.out.println("draw"); else System.out.println("lost"); } } i'm not understand where i'm done mistake..! help...
11th Aug 2021, 8:08 AM
Gnanendraa