Student Project

GUESSING GAME 2
Ability Level: Beginner
Estimated Time: 45 minutes
Objectives:
  • Understand and use IF blocks
  • Understand and use ElseIf
Materials and Resources:
  • Visual Basic Software
  • Textbook
Overview:
  • Create a program to have the computer pick a random number and allow a player to guess the number. The program will tell users if their guess is correct or, if incorrect, if the guess is too high or too low.
  • The program should allow the player to start new games or exit the game completely.
Instructions:
  1. In the Form Load routine, use the RND function to pick a random number between one and a hundred.
  2. Create a text box for players to enter their guess and a button for users to tell the computer the guess is ready to evaluate.
  3. Evaluate the guess by the players and display a message to tell users if their guess is correct or, if incorrect, if the guess is too high or too low.
  4. In the subroutine for the New Game button, clear the text box and assign a new value to the computers number. Reset any counters in use.
  5. Add an exit button with code to shut down the program.
Hints: One possible game board is displayed below. Display messages to the player using label captions, picture boxes, or message boxes.



PROJECT EXTRAS
  • Count and display how many attempts the player takes to guess the computers number.
  • Allow players a limited number of guesses. After the number of guesses has been exceeded, display the computers number.