
Write the code in java. Just a simple code with no While loop. If-else statement is permitted. Thanks.
import java.util.Scanner;
public class RockPaperScissors {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int computerGuess = (int) (Math.random()*3);
System.out.print("What do you pick(Paper=0, rock=1, scissor=2)? ");
int playerChoice = in.nextInt();
if(computerGuess == 0) {
switch (playerChoice) {
case 0:
System.out.println("Computer picked paper, I picked paper, tie");
break;
case 1:
System.out.println("Computer picked paper, I picked rock, I lost");
break;
case 2:
System.out.println("Computer picked paper, I picked scissor, I won");
break;
default:
System.out.println("Invalid choice");
}
} else if(computerGuess == 1) {
switch (playerChoice) {
case 0:
System.out.println("Computer picked rock, I picked paper, I won");
break;
case 1:
System.out.println("Computer picked rock, I picked rock, tie");
break;
case 2:
System.out.println("Computer picked rock, I picked scissor, I lost");
break;
default:
System.out.println("Invalid choice");
}
} else {
switch (playerChoice) {
case 0:
System.out.println("Computer picked scissor, I picked paper, I lost");
break;
case 1:
System.out.println("Computer picked scissor, I picked rock, I won");
break;
case 2:
System.out.println("Computer picked scissor, I picked scissor, tie");
break;
default:
System.out.println("Invalid choice");
}
}
}
}

Write the code in java. Just a simple code with no While loop. If-else statement is...
*3.17 (Game: scissor, rock, paper) Write a JAVA program that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws ** Have to...
Java CSC252 Programming II Static Methods, Enums, Constants, Random Rock Paper Scissors Write a program that allows the user to play "Rock, Paper, Scissors". Write the RPS class. All code should be in one file. main() will be part of the RPS class, fairly small, and contain only a loop that asks the user if they want to play "Rock, Paper, Scissors". If they say yes, it calls the static method play() of the RPS class. If not, the program...
Write a java program that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can break a scissor, and a paper can cover a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws. Allow the user to continue playing or quit.
JAVA Beginnings of a paper-rock-scissors game. Paper-rock-scissors is a game often used to make decisions. There are two players. Each player secretly chooses either, paper, rock or scissors. At the count of three, each player reveals what they have chosen. The winner of the game is determined this way: paper beats rock (because paper covers rock) rock beats scissors (because rock crushes scissors) scissors beat paper (because scissors cut paper) If the two players choose the same item, it is...
C++ Write a program that plays the rock, paper, scissors game. Rock beats scissors; scissors beats paper; paper beats rock. You must use these specific functions in your program. These are the prototypes: char generateP2toss(); int checkThrow(char, char); void printStatistics(int, int, int, int); void finalStatistics(int, int, int, int); void welcome(); Notes on these functions: generateP2toss() will generate the computer's toss (the computer is player2). It returns either an "r", "p", or "s/" checkThrow(char char) will check the throw by passing...
This is a C++ question need to complete project 2. attached the completed simple version of the program below but need the updated version which is listed in the project 2 outline Project 2 Rock, Paper, Scissors Updated Take the solution to Lab 3 and make sure the user enters a letter of R, P, or S and the computer generates a number between 0-2 and changes that number to a letter of R, P or S, using a switch....
Write a program that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws. Here are sample runs: Enter your selection: scissor (0),...
(C++) Hey guys we just went over loops and it got me
confused, it has me scrathcing my head for the past two days. I
would appreciate any help you guys have to offer. Few places I have
a hard time is get input and determine winner(cummulative
part).
Write a program that lets the user play the Rock, Paper,
Scissors game against the computer. The computer first chooses
randomly between rock, paper and scissors, but does not display its
choice....
Use Dev C++ for program and include all of the following. Im
lost.
Make sure the user enters a letter of R, P, or S and the
computer generates a number between 0-2 and changes that number to
a letter of R, P or S, using a switch. Make sure the user knows why
he/she has won or lost – print a message like “Paper covers Rock”
or “Scissors cuts Paper”.
Ask the user how many times he/she wants to...
please help me fix this. I'm getting it all mixed up in user defined functions. here's the question. This week we'll write a C program that lets the user play the game of Rock, Paper, Scissors against the computer. Your program will call a user-defined function named display_rules that displays the rules of the game. It then proceeds to play the game. To determine the winner, your program will call another user- defined function called determine_winner that takes two integer...