CSCI 220 Homework Assignment #8

Assigned Date: Wednesday, April 16, 2003 
Due Date: Wednesday, April 23, 2003 
Due Time: Noon 

Updated: Wednesday, April 16, 2003 09:23 PM

Program file names to be submitted: Hangman.java, HangmanDriver.java, Dictionary.java

Skills Developed: Creating classes. Program design.

Specification:

Extend the program that plays Hangman by adding the class Dictionary.  This class encapsulates a list of words. The Hangman program can ask a Dictionary object to give it a new word by calling method getWord(). This method accepts no parameters and returns a pointer to an array of characters.

A Dictionary object should store its words in an array of String type.  This array should be initialized through the default constructor.  A Dictionary object should also include a toString() method to return all the words in the dictionary (Hint: Use a loop to create a single concatenated String.)

Include these words into every Dictionary object.  

The getWord() method should randomly return one of these words every time it is called.  (Hint: Use Math.floor( Math.random() * MAX) to get a random number between 0 and MAX-1.)