import java.util.*; public class RockPaperScissors { public static void main(String[] args) { // declare your variables for this program: // a Random number generator (and instantiate it) // a char answer to store whether the user wants to play again // three int variables, the user's choice (0-2), computer's choice (0-2) // and who the winner is (0 for user, 1 for computer, 2 for tie) instructions(); // this method will display the instructions to the game do { pick1=getUserPick(); // getUserPick will get the user's pick of Paper, Rock, Scissors and store it as an integer value pick2=getComputerPick(g); // getComputerPick will generate a random number from 0-2 winner=determineWinner(pick1, pick2); // determineWinner will determine who wins and also output what the human and computer picked // you will output information about who won the game in determineWinner, but you will use the result in an enhancement to count the // number of wins by user of user and the computer answer=askAgain(); // askAgain will ask the user if he/she wants to play again and return the char Y or N } while(answer=='Y'); // have a goodbye message here // in enhancement #2, change the goodbye message to a summary of how many games/wins/ties/losses the user has had } public static void instructions() { // put some println statements here to print out the instructions of the game } public static int getUserPick() { // declare a Scanner and a char local variable // ask the user to input 0-2 (describe what each is) and input the int value, data verifying it // return the number picked } public static int getComputerPick(Random g) { return g.nextInt(3); } public static int determineWinner(int u, int c) { // user's pick is u, computer's pick is c, these will both be numbers from 0-2 // Here are the possible outcomes, write if-else statements to accomplish this: // U C Outcome // 0 0 tie (both picked paper) // 0 1 user wins (paper wraps rock) // 0 2 computer wins (scissors cuts paper) // 1 0 computer wins (paper wraps rock) // 1 1 tie (both picked rock) // 1 2 user wins (rock smashes scissors) // 2 0 user wins (scissors cuts paper) // 2 1 computer wins (rock smashes scissors) // 2 2 tie (both picked scissors) // output the proper outcome above such as "Its a tie, both picked paper" or "Computer wins, rock smashes scissors" // return 0, 1 or 2 depending on who won } public static char askAgain() { // ask the user if they want to play again, upper case their answer and return the charAt(0) } }