CIS 163 AA - Java Programming I - Section 5811
Worksheet #5
Due Monday, October 31, 2005

Name:

I. Definitions: please explain the following terms:

  1. conditional statement

  2. conditional operator

  3. iterator

  4. boolean expression

  5. compareTo method

  6. radio button

  7. block statement

  8. dialog box

II. Question or short essay

  1. What are differences between logical operators and relational operators?

  2. Describe the syntax of the for statement.

  3. What is a nested loop?

  4. How do you compare strings for equality?

  5. How are check boxes different from radio buttons?

  6. How is a do loop different from a while loop?

  7. What is the purpose of proper indentation in conditionals and loops?
III. Programming Exercises Write source code for the following:

    Design and implement an application that plays the HI-LO guessing game with numbers. The program should pick a random number between 1 and 100 (inclusive), then repeatedly prompt the user to guess the number. On each guess, report to the user that they are correct, or whether the guess was high or low. Continue accepting guesses until the user guesses correctly or chooses to quit. Use a sentinel value to determine if the user wants to quit. Count the number of guesses and report that value when the user guesses correctly.