Daily Exercise 08:
Rock  Paper Scissors



For this assignment you're going to write a computer program that will play Rock, Paper, Scissors. It won't be much fun as a game yet but perhaps we'll return to the example again in a week or two.

This is the first exercise where a little forethought will help. The program can be written without a lot of code if you use the right concepts.

The program will first ask the typist for a number. Then the typist will be introduced to the game. The typist must enter either the word "Rock", "Paper", or "Scissors". The computer will use that first number entered to determine what the computer choice is and, from these two pieces of information, determine whether the typist wins, the computer wins or whether it is a tie.

For this exercise, case matters; that is, if the typist enters "ROCK" or "paper" or anything except one of the three strings. If the typist doesn't enter one of these three words exactly, the computer should point this out and claim to win.

The rules for RPS are:

Use the following rule to determine the computer's choice based on the number provided:

Sample Output 1:

Please enter an int: 569

Welcome to the Rock, Paper, Scissors game

What is your choice? Paper
The computer picks Scissors.
The computer wins.

Sample Output 2:
Please enter an int: 721

Welcome to the Rock, Paper, Scissors game

What is your choice? Paper
The computer picks Rock.
You won!

Sample Output 3:
Please enter an int: 17

Welcome to the Rock, Paper, Scissors game

What is your choice? H Bomb
Bogus! You lose.