Question: The game rock-paper-scissors is a classic first semester programming assignment (it is C3PP8 of our text). If I assigned programming a player vs. computer game

The game rock-paper-scissors is a classic first semester programming assignment (it is C3PP8 of our text). If I assigned programming a player vs. computer game of rock-paper-scissors you would easily be able to do that. So lets make it more interesting.

Your assignment is to program a game (player vs. computer) of Rock-Paper-Sissors-Lizards-Spock.

  • Your program will have one player playing against the computer
  • The player will enter a character - you are to take it in as a char not as a String. There is no nextChar() method, the way to get in a char is explained in: Video: Getting Characters through the Keyboard which is in the module for Chapter 2.
    • R (for rock)
    • P (for paper)
    • S (for scissors)
    • L (for lizard)
    • K (for spock)
  • Your program will generate a random char to represent rock, paper, scissors, lizard, or spock. Hint: you could generate a random number 0 - 4 and assign the char value based on the number generated.

  • The player input will be compared to the randomly generated value of the computer
  • Your program will output the appropriate message

Name your program Rock.java

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!