This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: the class, your program should display: Seat 1, Seat 2, Seat 3, Seat 4, Seat 5 Seat 1, Seat 2, Seat 3 Guess in 20 Questions with a Twist Write a program that generates a random integer r between 1 and 20. Then it prompts the user to guess a value. At each step, your program should compare the user-entered value with r and announce: “larger, smaller, or You win!” if the guessed value is larger, smaller or equal to r respectively. The only catch is that the user is restricted to alternate his guesses between even and odd numbers. In other words, if his first value is an odd number, in the next step he has to choose an even number and so on. Ensure that your program restricts the user to do so. End the game in 20 steps and announce “You Lose!” if the user doesn’t win by then....
View Full Document
- Winter '07
- seat, static void addOne