Write a simple rock-paper-scissors (aka, jan-ken-pon) game that plays only a single round.
Concepts: Review of conditionals, Strings, random numbers, methods.
• Ask the user to enter a move, either as a string or as an int.
You can have them enter one of the words "rock", "paper", or "scissors". Sample prompt:
Enter your move (rock, paper, or scissors):
Or you can instead print a short menu explaining how the numbers 1, 2 and 3 map to "rock", "paper", or "scissors", and then ask them to enter the corresponding number. Something like this would work (though you could possibly do it clearly in a single line instead). Sample menu prompt:
1) Rock 2) Paper 3) Scissors Enter the number of your move:
• Once you have the player's move, generate a random move for the computer. Each of the three possible move should be equally likely. Print the move as "rock", "paper", or "scissors" (not as a number!) on its own line. Sample:
Computer's move: paper
• Then determine and display who won on another line. The rules are simple: paper beats rock, rock beats scissors, scissors beats paper. If the two moves are the same (for example, both rocks) then the game is a tie.
When displaying output, you may refer to the computer as "computer", "PC", "I", or "my". You may refer to the player as "player", "user", "human", or "you". (Case does not matter.) Print who "won" or "wins", or print that the game is a "tie" or "draw". Do not print who lost. Three sample outcomes:
You won! The computer wins. Game was a tie.
The game should only play one round and then quit.
• Your program must include at least one
static method in addition to
UsernameA09.java file to Tamarin.
main(that you actually call from within
.equalsIgnoreCaseto compare Strings