Program 4, Guess What?

Short Description:

Play a guessing game.

Goals

When you finish this homework, you should:

Formal Description

Write a program which will play a number guessing game. You should create the code to play either part of this game.

A guessing game is played by two entities. A guesser, who attempts to guess a number and a picker, who selects the number to be guessed. Your program should be able to assume either of these roles.

Each game should begin with he user being presented with the choice of roles.

If the user selects guesser, the program should select a random number in the desired range, and allow the user to enter guesses. The program should classify the guess as high, low or right. If the guess is right, the game is over.

If the user selects picker, then the program should attempt to guess the number the user has selected. The program should select a guess, present it to the user and then read in a phrase. If the phrase contains the word high, then the guess is too high, if it contains the word low, then the guess is too low, and if it contains the word right, the guess is correct. A phrase will never contain more than one of these words, but it might not contain any.

Please note, the word will not always be in lower case letters. "Your guess is way too HIGH" is a valid response.

Be careful with the phrase, it might be as simple as "high", or as complex as "your guess was way way way too high". You must allow the user to enter a phrase, even though it might be easier to present them with a menu. This is a program requirement.

When one game is finished, the user should be presented with a choice to play another game, or quit.

Discussion

You should make appropriate use of constants and variables.

Your identifiers should be constructed properly, with meaningful names.

You should document your code with comments.

Your program should be fully interactive and provide the user with instructions.

Your output should be organized, easy to read, and make appropriate use of white space.

Required Files

A single source code file.

Submission

Submit your program to the D2L assignment folder Program 4 by the due date.