I am writing a rock paper scissors game in java but there are some things I can't figure out. First of all, I want to make it so that the user can type "Rock" or "paper" instead of 1, 2, and 3 but I can't figure that out. Secondly, I'm supposed to be using nested if else statements but I don't know how to do that either with what I've been doing. My code is below
import java.util.Scanner; public class RockGame {
  private final static int ROCK=1;
  private final static int PAPER =2;
  private final static int SCISSOR =3;
  private static Scanner key;
public static void main(String args[]){
         int playerOneScore = 0;
         int computerScore = 0;
         int userPlay, computerPlay;
        String val = key.nextLine().toLowerCase();
         key = new Scanner(System.in);
         while(playerOneScore <2 && computerScore <2){
                 System.out.println("Choose 1 for rock, 2 for paper, and 3 for sciscors!");
                 userPlay = key.nextInt();
                 computerPlay = (int)(Math.random()*3) +1;
                 if(val.equals("rock"))
                       userPlay = ROCK;
                 else if (val.equals("paper"))
                         userPlay =PAPER;
                 else if (val.equals("scissors"))
                         userPlay=SCISSOR;
                 if (val.equals("rock"))
                         computerPlay = ROCK;
                 else if (val.equals("paper"))
                         computerPlay =PAPER;
                 else if (val.equals("scissors"))
                         computerPlay=SCISSOR;
                 if (computerPlay ==ROCK && userPlay==SCISSOR ){
                         System.out.println("The computer chose rock, you chose scissors.\n You lose!");
                         computerScore++;
                 }
                 if (computerPlay ==ROCK && userPlay==PAPER ){
                         System.out.println("You computer chose rock, you chose paper.\n You win!");
                         playerOneScore++;
                 }
                 if (computerPlay ==PAPER && userPlay==SCISSOR ){
                        System.out.println("The computer chose scissors, you chose paper.\n You win!");
                         playerOneScore++;
                 }
                 if (computerPlay ==PAPER && userPlay==ROCK ){
                         System.out.println("The computer chose paper and you chose rock. \n You lose!");
                         computerScore++;
                 }
                 if (computerPlay ==SCISSOR && userPlay==ROCK ){
                         System.out.println("The computer chose scissors and you chose rock. \n You win!");
                         playerOneScore++;
                 }
                 if (computerPlay ==SCISSOR && userPlay==PAPER ){
                         System.out.println("The computer chose scissors and you chose paper. \n You lose!");
                         computerScore++;
                 }
                 if (computerPlay == userPlay ){
                         System.out.println("The computer chose the same thing you did! \n Tie!");
                 }
         }
         if(computerScore > playerOneScore)
                 System.out.println("Computer win score is: - "+ computerScore + " -" + playerOneScore  );
         else
                 System.out.println("Your score is: " + playerOneScore + "-" + computerScore );
  }
}
 
     
     
     
     
     
     
     
     
     
    