asks the user to enter a name for the "player". The player’s name must not be blank. If this option is chosen again after a player has already been set up, a "new" player is created (ie. with a new name, no prizes, $0 spent). Note that the "new" player replaces the "old" player - ie. there is only ever one player at any one time.
simulates a lucky guess operation. The computer generates a random number between 1-5. It then asks the player what prize he would like to win by trying to guess that number. The rules are :
-
If the player guesses wrongly, he wins nothing and loses the money ($1-5).
-
If the user enters a number which is less than 1, or more than 5, it will be rejected, and he does not lose any money.
displays some statistics about the current player's prizes (and worths) and total amount spent..., such as :
display rules of play
exits the program. All player statistics will be cleared.
-
The menu will be displayed repeatedly, until the user chooses Option (5). Inputs other than 1-5 will be rejected, and an error message printed.
-
If the user chooses Options (2) or (3), before a player has been set up, an appropriate error message will be printed.