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
Step: 1
Get Instant Access to Expert-Tailored 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