Java Reference
In-Depth Information
13.8 Lab
Create a poor man's drawing program. The program should allow the user to free-draw
shapes. The drawing should be represented as an ArrayList of shapes, where every shape
should be represented as an ArrayList of points. Allow the user to open and save drawings
through appropriate menus. A drawing should be saved in a file as a binary stream.
13.9 Project
Extend the Hangman game from Chapter 3 by allowing the words to be read from a file.
To start off, you will need to create a file that contains a bunch of dicult words (use the
Internet to find such a file). Next, you will select a random word from this file and ask the
player to guess it by guessing letters. The player is allowed 6 wrong letter guesses, where
6, of course, will be defined as a constant at the beginning of the program. After the sixth
wrong guess, the player should see the message: “You lose, the word was ...!”. If the user
is able to guess all the letters before there are six wrong guesses, then they should see the
message “You win”.
Here is an example run of the program. User input is in italic.
Try to guess my word!
Enter a letter: Hi
Sorry, that's not a letter.
Enter a letter: a
Try again
Enter a letter: b
Try again
Enter a letter: c
Try again
Enter a letter: m
Enter a letter: i
Enter a letter: q
Try again
Enter a letter: p
Enter a letter: t
Try again
Enter a letter: w
Sorry, that's wrong.
You lose, the word was Mississippi!
Use a StringBuffer to store the current word that contains underscores.
Search WWH ::

Custom Search