Question
In JAVA Chapter 5Assignment(Rock, Paper, Scissors)20pointsYour goal is towrite a program that lets the user play the game of Rock, Paper, Scissors against the computer.Your
In JAVA
Chapter 5Assignment(Rock, Paper, Scissors)20pointsYour goal is towrite a program that lets the user play the game of Rock, Paper, Scissors against the computer.Your program should have the following: Make the name of the project RockPaperScissorsWrite a method that generates a random number in the range of 1 through 3. The randomly generated number will determine if the computer chooses rock, paper, or scissors. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3 then the computer has chosen scissors.Return the computers choice.(5points)Write another method where the user enters his or her choice of rock, paper, or scissors. You can usecommand line or message box. You can choose to have the user type the wordor use a menu choice. If the user does not enter a valid choose,prompt them for the choice again(You can do this inside of this method or create another method to do the validation).Return the users choice.(6points)Write another method to determine the winnerand display the results. Write conditionals to determine the winner. Ifone player chooses rock andthe other player choose scissors, then rock wins. (Rock smashes scissors).If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cut paper).If one player chooses paper and the other player chooses rock, then paper wins. (Paper wraps rock.)If both players make the same choice, the game must be played again to determine the winner.Display the computers choice, the users choice, and whether or not the computer or the user won/tied. (5points)In the main method, call the method that generates the computers choice and save this choice in a variable. Call the method to get the users choice and save in a variable. Callthemethod to determine the winnerand displayresults method(You will need to usea loop to repeat this method if the computer and the user choices were tied).(4points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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