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:

  1. A graphical user interface
  2. The letters should be selected by creating buttons (see applet below) which can be active or inactive depending on the state.
  3. The program should display graphically the status of "hangman". See the blue/cyan pane in the applet below.
  4. The program should display the number of guesses as well as the average number of guesses per word.
  5. Allow a maximum of 6-8 guesses per word (fix the number based on your creation of the hangman graphic).
  6. 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

   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.

  1. 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.
  2. 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.
  3. Make sure you enter your name in the NAME slot at the top of the program. Also, use the SIGNATURE slot in your applet.
  4. Post the applet on your web page.
  5. Once you are done with the exercise, hand in a printed (stapled) report that contains the following:



Back to: CS110 Course Materials