ножницы для рок -бумаги в Java
if (personPlay.equals(computerPlay)) {
System.out.println("It's a tie!");
}
else if (personPlay.equals("R")) {
if (computerPlay.equals("S"))
System.out.println("Rock crushes scissors. You win!!");
else if (computerPlay.equals("P"))
System.out.println("Paper eats rock. You lose!!");
}
else if (personPlay.equals("P")) {
if (computerPlay.equals("S"))
System.out.println("Scissor cuts paper. You lose!!");
else if (computerPlay.equals("R"))
System.out.println("Paper eats rock. You win!!");
}
else if (personPlay.equals("S")) {
if (computerPlay.equals("P"))
System.out.println("Scissor cuts paper. You win!!");
else if (computerPlay.equals("R"))
System.out.println("Rock breaks scissors. You lose!!");
}
else
System.out.println("Invalid user input.");
Hurt Hamster