Question: In java coding RockScissorsPaper Problem Rock wins over scissor, Scissor wins over Paper and paper wins over rock (Switch ) Use a random generator and

In java coding

RockScissorsPaper Problem Rock wins over scissor, Scissor wins over Paper and paper wins over rock (Switch )

Use a random generator and generate one number for 0,1,2 representing scissor , rock , paper

Input from user a value as scissor (0), rock (1), paper (2):

Determine if User or computer wins.

Switch on Computer Value(0,1,2)

for each case say eg comp value is 0 (scissors) check on users value using if-else

If both are equal its a draw. If you get a paper you lose If you get a rock computer wins

Check for other 2 cases

One example is shown here

case 0: if (userNumber == 0) System.out.print("The computer is scissor. You are scissor too. It is a draw");

if (userNumber == 2) System.out.print("The computer is scissor. You are paper. You lost

Check the 3 rd condition

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!