Spring Semester 2005

Bonus Problems: Preparation for the TBS
1. Suppose you determine that

How long before it drops below a certain threshold (y percent), at which point it is no longer serviceable?

Write a program that

2. Write a program that

The program should then report the largest and smallest values that were entered.

3. How many guesses does it take to guess a secret number between 1 and n?

For example,

If we continue to divide the range in half, we'll eventualy get down to to one number.

Write a program that

4. A palindrome is a string that is spelled the same way backward and forward. For example,

are all examples of palindromes. Two more examples are

Write a program that lets the user type a word or phrase and then determines whether the string is a palindrome.

5. Design and implement a program that plays Time Bomb (also known as Hangman) with the user.

Here's how the game works. The computer picks a secret word and then prints one asterisk for each letter in the word:

* * * *
The user guesses at the letters in the word. For every correct guess, an asterisk is replaced by a letter:
* e * * *
Store the secret words in a delimited string and invent your own representation for the time bomb.

(Just printing the count of guesses would suffice I think).

6. Design and implement a program that plays the following game with the user.

For every guess the player has to tell the computer whether it's too high or too low.

The computer should be able to guess the letter within five guesses.

Do you see why?

Last updated by Adrian German for A201/A597/I210 on Tue Mar 29 15:32:24 EST 2005