Question
Game Paper, Scissors,rock Java program using Array, so that: 1 - It uses a looping mechanism. It will play the game at least once and
Game Paper, Scissors,rock Java program using Array, so that:
1 - It uses a looping mechanism. It will play the game at least once and print the outcome. Then, it will then ask the user if they would like to play again (Yes or No). If they choose Yes, then loop again to play the game again. If they choose No, then quit the program. Be sure to handle upper / lower case. 2 The code will use a one-dimensional array that lists the 3 choices we have: 0 is scissors, 1 is rock, and 2 is paper. We can have the number (0, 1, 2) correspond to the index of the array: // possible choices final static String[] choices = {"scissors", "rock", "paper"}; 3 - The code will use a two-dimensional array to keep track of the rules of the game. This will replace the need of a complex and/or nested if statement to determine who won the game. Design the two-dimensional array and then implement it in the code. The 2D array could hold the outcome, in String form, that can be used to determine what message should be displayed. The rows represent what the user chose and columns represent what the computer chose. Sample Output: Enter 0 for scissors, 1 for rock, or 2 for paper: 0 The human chose scissors. The computer chose paper. Human wins. Do you want to play again? Yes Enter 0 for scissors, 1 for rock, or 2 for paper: 2 The human chose paper. The computer chose scissors. Computer wins. Do you want to play again? Yes Enter 0 for scissors, 1 for rock, or 2 for paper: 1 The human chose rock. The computer chose rock. It is a draw.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started