CIS 162 AD - C# Programming I - Section 5832
Worksheet #5
Due Thursday, March 30, 2006

Name:

I. Definitions: please explain the following terms

  1. GUI

  2. event

  3. event handler

  4. Form

  5. Controls

  6. derived class

  7. Name property

  8. BackColor property

II. Questions or short essay:

  1. What are important design considerations as you create the Graphic User Interface for your program?

  2. Describe five properties of the Form class.

  3. What is the purpose of the Text property for a control?

  4. What do you use TextBox objects for?

  5. Describe differences between how console applications, and windows applications work.

  6. How do you put code for a button click event into your program?
III. Programming Exercises Create the following program:

    Create a higher/lower guessing game using a graphical user interface. Allow a user to keep guessing until he guesses the number. Choose two colors for your game: one should be used to indicate that the value the user guessed is higher than the target; the other is used to indicate that the value the user guessed is lower than the target. With each new guess, change the form color based on whether the guess is higher than the target or lower. Keep a count of the number of guesses. when the the user hits the target, display a MessageBox indicating the number of guesses it took. Several approaches can be used to seed the target: one is to generate a random number by constructing an object of the Random class. For example, the following stores a random whole number between 0 and 100 in target:
    Random r = new Random();
    int target = r.Next(0, 100);