Rock, Paper, Scissors

Program Rock.java contains a skeleton for the game Rock, Paper, Scissors. Open it and save it to your directory. Add statements to the program as indicated by the comments so that the program asks the user to enter a play, generates a random play for the computer, compares them and announces the winner (and why). For example, one run of your program might look like this:
Enter your play: R, P, or S
r
Computer play is S
Rock crushes scissors, you win!

Note that the user should be able to enter either upper or lower case r, p, and s. The user's play is stored as a string to make it easy to convert whatever is entered to upper case. Use a switch statement to convert the randomly generated integer for the computer's play to a string. You are required to provide a "default" clause for every "switch" statement.

This is your first exposure to pseudo-random number generators in Java. Check out this web page for a brief tutorial on how to use these generators.

For many students, the hardest thing about this assignment is the nested if statements at the bottom of the program. This is because it can be confusing to determine which "else" matches which "if". If this confuses you, use a compound statement (i.e., curly brackets) after each "if" and "else". In general, an "else" matches the nearest preceding "if" that has not already been matched to an "else".

To Hand In:

Hardcopy of your code and a transcript of your program running at least twice.