CS 110 Introduction to Computing
Spring 2002
Project #5: Word Game: Hangman
Due in class on Thursday April 30-May 2, 2002
See below for notes on the deadline.
Write a Java program that plays the game of Hangman. Your program
should have the following:
- A graphical user interface
- The letters should be selected by creating buttons (see applet
below) which can be active or inactive depending on the state.
- The program should display graphically the status of "hangman".
See the blue/cyan pane in the applet below.
- The program should display the number of guesses as well
as the average number of guesses per word.
- Allow a maximum of 6-8 guesses per word (fix the number based on your creation
of the hangman graphic).
- A dictionary class conatining words will be provided at a
later date for use with your program. Its interface is discussed
below.
Here is an example applet (not yet complete) for your guidance.
Your applet should have similar functionality, but design the
GUI on your own, this is just a sample design.
Some useful pointers and hints: Go
to Implementation Notes/Schedule
- Hangman is a popular word game. Search on the internet to find out many
versions of it to get ideas for your applet.
- We will discuss the creation of the dictionary in class. For now assume
that there is a class defined as follows:
public class Dictionary {
public static final int nWords; // #of words contained in dictionary
public Dictionary() {
// creates a new dictionary of nWords
....
}
public String getWord() {
// returns a word from the dictionary
}
}
Notes for the exercise:
DEADLINE: You will have to give a LIVE demonstration of your applet to the
instructor. Schedule a time between April 30 and May 2 with your instructor
for this. Hand in the printed project at the time of your demonstration.
Since this is the last project of the semester, NO EXTENSIONS OR LATE SUBMISSIONS
will be accepted.
- You will not be able to view your applet in Netscape on Macs due to a shortcoming
in Netscape's Java compatibility. However, all current versions of Internet
Explorer (on Macs and PCs), and netscape (on PCs) will work just fine. For
all your CodeWarrior work continue to use the Applet Viewer.
- Play close attention to the syntax. Every Java instruction has to be written
with proper punctuations as well as with consistent use of upper/lower case
character combinations.
- Make sure you enter your name in the NAME slot
at the top of the program. Also, use the SIGNATURE
slot in your applet.
- Post the applet on your web page.
- Once you are done with the exercise, hand in a printed (stapled) report
that contains the following:
- A printout of your Java program
- A screen snapshot of your applet.
- A printout of your project window.
- A short essay on your experience in doing this assignment. We want to
know how it all worked out for you and how you feel about completing this
assignment.
Back to: CS110 Course Materials