PSICS Fall 2004 Quiz #9

Quiz #9 - 11/04/04
Due by Friday 11/05 at 11PM (to WebCT)

Submit your solutions to this quiz by dropping in your webct drop box in the box labeled "Quiz9". Let Dave know if you have problems submitting!

Assignment

GUI based number guessing game

Write a function named play-number-game that displays a window in which the user can play a simple number guessing game. The user is allowed to submit guesses by typing a number in a textbox and pressing a button. Each time the user submits a guess the GUI should update a status message that indicates whether the guess is invalid, too low, too high or correct.

The function play-number-game is passed a number in the range 0-100, this number is the actual answer used by the game. For example, if the function is called like this:

(play-number-game 87)

The user must try to guess the number 87. The game can also be called like this:

(play-number-game (floor (random 101)))

to use a random number as the correct answer.

The required functionality:

IMPORTANT! You must provide the function play-number-game (don't just write some code that allows the user to play the game without calling play-number-game).