+ 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
5 Answers
+ 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!!!");
}
+ 5
yahel you are welcome
+ 4
There are several "||" conditions after line 46. So include them in parenthesis which will give appropriate output.
+ 1
Swapnil I don't understand.. can you please write the correct code in here? (Just copy paste and fix the wrong part)
+ 1
Swapnil thank you!!!