+ 2

Can you help plz? The problem is the part of code that is between these two: //---------------------------- ... (in the bottom)

The problem is that if you draw it says that you won(not a draw) take a look at the code... https://code.sololearn.com/cpXU1RA6zTW9/?ref=app

6th Apr 2020, 1:50 PM
Yahel
Yahel - avatar
5 odpowiedzi
+ 5
if((x.equals("rock")||x.equals("Rock")) && y.equals("Scissors")){ System.out.println("You won!!!"); } else if((x.equals("paper")||x.equals("Paper")) && y.equals("Rock")){ System.out.println("You won!!!"); } else if((x.equals("scissors")||x.equals("Scissors")) && y.equals("Paper")){ System.out.println("You won!!!"); } else if((x.equals("rock")||x.equals("Rock")) && y.equals("Rock")){ System.out.println("Its a draw!"); } else if((x.equals("paper")||x.equals("Paper")) && y.equals("Paper")){ System.out.println("Its a draw!"); } else if((x.equals("scissors")||x.equals("Scissors")) && y.equals("Scissors")){ System.out.println("Its a draw!"); } else{ System.out.println("You lost!!!"); }
6th Apr 2020, 2:51 PM
...
+ 5
yahel you are welcome
6th Apr 2020, 3:17 PM
...
+ 4
There are several "||" conditions after line 46. So include them in parenthesis which will give appropriate output.
6th Apr 2020, 2:34 PM
...
+ 1
Swapnil I don't understand.. can you please write the correct code in here? (Just copy paste and fix the wrong part)
6th Apr 2020, 2:44 PM
Yahel
Yahel - avatar
+ 1
Swapnil thank you!!!
6th Apr 2020, 3:14 PM
Yahel
Yahel - avatar