1. Define constants for Rock, Paper, Scissor. Constants use the final keyword and their identifiers are all captial letters. Define your constants before the main() method (outside of the method – cannot define static within a method).
final static int SISSOR = 0;
2. Prompt the User for their choice.
Enter sissor (0), rock (1), paper (2)
3. Generate a random choice for the computer (note: how do you typecast to int?)
Use Math.random() * range
4. Use switch statements to generate Strings for both the computer and the user’s choice.
switch (compChoice) {
case PAPER: System.out.print("The computer is paper,");
break;
case ROCK: System.out.print("The computer is rock,");
break;
case SISSOR: System.out.print("The computer is sissor,");
break;
}
switch (userChoice) { //todo…
5. Use selection (if – else if – else ) statements to determine it’s a draw or there is a winner.
6. Display the results.
The computer is paper,the user is sissor, You win.
7. Test your results. Verify all possible choices for the User and Computer are generated.
Your output should look like the following ( 3 separate runs ):