CS 140 - Final exam Review Question - HiLow

Tuesday April 28

You may use your notes, the computer, and any previous programs we have developed this semester. Make sure you save your program in a folder named HiLow in your student folder.

In the game of Hi-Low the computer picks a random integer between 1 and 100 and the user has to guess the answer. If the user guesses too high then the computer responds "Higher"; too low and the computer responds "lower". The game continues until the user gets the answer.

Enhancements

  1. Have the program also print out the number of guesses the user has made so far.
  2. Allow the user to play the game multiple times by prompting them.
  3. Have the user actually lose the game if they don't guess within seven tries.
  4. Don't allow the user to enter bogus input; for example a number that is less than 1 or greater than 100, or a number that is contrary to the computer's advice.