Once you get the input:
-
if check the input is equal to “1”, then print “Rock”.
-
else if check the input is equal to “2”, then print “Paper”.
-
else if check the input is equal to “3”, then print “Scissors”.
-
else, then print “invalid input”.
The pseudo code for the above steps is below:
if computer input is int, declare input as int and use input == 1, meaning compare input value with == for 1,2 and 3 instead of input.equals(“1”) or “2” and “3”.
or if you want to convert int to String, use this Integer.toString(int value); where this method converts int value to String.
if(input.equals("1"))
{
System.out.println("Rock");
}
else if(input.equals("2"))
{
//print paper
}
else if(input.equals("3"))
{
//print Scissors
}
else
{
//invalid input
}