0

Java 12.2

Ребят кто решил задачу? Покажите решение. show the solution to the problem

18th Apr 2021, 6:22 AM
Igaman Igaman
Igaman Igaman - avatar
14 ответов
+ 5
Igaman Igaman Yes show the attempts of the problem. Да покажите попытки проблемы.
18th Apr 2021, 6:36 AM
A͢J
A͢J - avatar
+ 3
Igaman Igaman The correct solution is 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) { System.out.println("Suspended"); } else { if(ourScore < theirScore) { System.out.println("Lost"); } else if(ourScore > theirScore) { System.out.println("Won"); } else { //no need to check equality System.out.println("Draw"); } }
18th Apr 2021, 8:45 AM
A͢J
A͢J - avatar
+ 2
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(); int x,y; if (false) { if(z < y) { System.out.println("Lost"); } else if(x > y) { System.out.println("Win"); } else if(x == y) { System.out.println("Draw"); } else { System.out.println("Suspended"); } } } }
18th Apr 2021, 6:38 AM
Igaman Igaman
Igaman Igaman - avatar
+ 2
Igaman Igaman Why there is Hard Code condition if(false) if you have an input isSuspended? Почему существует условие Hard Code if (false), если у вас есть вход isSuspended?
18th Apr 2021, 6:54 AM
A͢J
A͢J - avatar
+ 2
Igaman Igaman And why there are x and y when ourScore and theirScore are given? И почему есть x и y, когда даны ourScore и theirScore?
18th Apr 2021, 6:58 AM
A͢J
A͢J - avatar
+ 2
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(); How get suspended if true? int theirScore = read.nextInt(); if(ourScore < theirScore) { System.out.println("Lost"); } else if(ourScore > theirScore) { System.out.println("Win"); } else if(ourScore == theirScore) { System.out.println("Draw"); } } }
18th Apr 2021, 7:43 AM
Igaman Igaman
Igaman Igaman - avatar
+ 2
Igaman Igaman Because there is Won not Win so just change Win to Won
18th Apr 2021, 8:53 AM
A͢J
A͢J - avatar
+ 1
I'm confused, can you explain?
18th Apr 2021, 6:56 AM
Igaman Igaman
Igaman Igaman - avatar
+ 1
You are the administrator of the football club and must categorize the games that have already been played on the team's website. The program takes 3 inputs: 1. match status - which determines whether the match was postponed ("true") or not ("false") 2. your team points 3. points of the opposing team. Modify the program so that if the match is postponed (the first input value is "true"), it displays "Suspended". If the match has not been postponed (the first entered value is false), then, depending on the result of the match, one of the following statuses must be set: "Won", "Lost" and "Draw". Sample input false 3 2
18th Apr 2021, 6:57 AM
Igaman Igaman
Igaman Igaman - avatar
+ 1
I have incorrectly translated ourscore and theirscore :(
18th Apr 2021, 7:00 AM
Igaman Igaman
Igaman Igaman - avatar
+ 1
now I'll try to solve
18th Apr 2021, 7:01 AM
Igaman Igaman
Igaman Igaman - avatar
+ 1
How get “suspended” if true?
18th Apr 2021, 7:44 AM
Igaman Igaman
Igaman Igaman - avatar
0
Wow))) thats easy, but closed test 5 is wrong
18th Apr 2021, 8:51 AM
Igaman Igaman
Igaman Igaman - avatar
0
Its working!!!!! Thank you!)
18th Apr 2021, 9:11 AM
Igaman Igaman
Igaman Igaman - avatar