import java.util.Random;
import static java.lang.System.out;
import java.util.Scanner;
class Simulator {
public static void main(String args[]) {
Random myRandom = new Random();
Scanner myScanner = new Scanner(System.in);
char Rock, Paper, Scissors;
char input;
out.println("Welcome to rock/paper/scissors!");
out.println("Which object would you like to choose?");
do {out.println("Invalid input.Please try again.");
} while ((input != 'R') || (input != 'r') || (input != 'P') || (input != 'P') || (input !='S') || (input != 's'));
input = myScanner.findInLine(".").charAt(0);
if ((input == 'R') || (input == 'r')) {
input = Rock;
randomNumber = myRandom.nextInt(8);
switch (randomNumber) {
case 0: out.print("You chose a rock and the computer chose a paper. You lose!");
case 1: out.print("You chose a rock and the computer chose a paper. You lose!");
case 2: out.print("You chose a rock and the computer chose a paper. You lose!");
break;
case 3: out.print("You chose a rock and the computer chose a scissors. You win!");
case 4: out.print("You chose a rock and the computer chose a scissors. You win!");
case 5: out.print("You chose a rock and the computer chose a scissors. You win!");
break;
case 6: out.print("You chose a rock and the computer chose a rock. It's a tie!");
case 7: out.print("You chose a rock and the computer chose a rock. It's a tie!");
case 8: out.print("You chose a rock and the computer chose a rock. It's a tie!");
break;
}
}
if ((input == 'P') || (input == 'p')) {
input = Paper;
randomNumber = myRandom.nextInt(8);
switch (randomNumber) {
case 0: out.print("You chose a paper and the computer chose a paper. It's a tie!");
case 1: out.print("You chose a paper and the computer chose a paper. It's a tie!");
case 2: out.print("You chose a paper and the computer chose a paper. It's a tie!");
break;
case 3: out.print("You chose a paper and the computer chose a scissors. You lose!");
case 4: out.print("You chose a paper and the computer chose a scissors. You lose!");
case 5: out.print("You chose a paper and the computer chose a scissors. You lose!");
break;
case 6: out.print("You chose a paper and the computer chose a rock. You win!");
case 7: out.print("You chose a paper and the computer chose a rock. You win!");
case 8: out.print("You chose a paper and the computer chose a rock. You win!");
break;
}
}
if ((input == 'S') || (input == 's')) {
input = Scissors;
randomNumber = myRandom.nextInt(8);
switch (randomNumber) {
case 0: out.print("You chose a scissors and the computer chose a paper. You win!");
case 1: out.print("You chose a scissors and the computer chose a paper. You win!");
case 2: out.print("You chose a scissors and the computer chose a paper. You win!");
break;
case 3: out.print("You chose a scissors and the computer chose a scissors. It's a tie!");
case 4: out.print("You chose a scissors and the computer chose a scissors. It's a tie!");
case 5: out.print("You chose a scissors and the computer chose a scissors. It's a tie!");
break;
case 6: out.print("You chose a scissors and the computer chose a rock. You lose!");
case 7: out.print("You chose a scissors and the computer chose a rock. You lose!");
case 8: out.print("You chose a scissors and the computer chose a rock. You lose!");
break;
}
}
}
}