Allan Didier

Rock, Paper, Scissors


Write a Java program that can play the game Rock, Paper, Scissors. 


  • Conditional statements (if else statements)

Program Details

PP 5.7, page 264

Design and implement an application that plays the Rock-Paper-Scissors game against the computer. The program should randomly choose one of the three options (without revealing it), then prompt for the user’s selection. At that point, the program outputs both choices and prints a statement indicating if the user won, computer won, or if it was a tie.

When the game is played between two people, each person picks one of three options (usually shown by a hand gesture) at the same time, and a winner is determined. In the game, Rock beats Scissors, Scissors beats Paper, and Paper beats Rock.

Since we have not learned how to use Strings (letter variables), you can use numbers for choices (1 = rock, 2 = paper, 3 = scissors).

Make sure to actually output the computer choice and play it exhaustively to test it, i.e. play every combination. 


Java Textbook

Chapter 5: Conditionals and Loops

CS Awesome Website

Bill Barnum's AP Computer Science A videos

AP College Board test prep videos