comic and text by stoopad.com is licensed under a Creative
Commons Attribution-Noncommercial-Share Alike 3.0 United
States License.
Due: 2:00pm, Monday, November 9. Value: 30 pts. Submit to Sauron.
We'll now complete the Hangman program we began in Assignment 11.
I'm providing you the framework for this solution in
HangmanII.java, which deals
with selecting a word and handling user interaction. One of the
included classes is Hangman, but you could just as
easily replace it with your solution from the earlier
assignment. It is also missing another class named
Status.
The only code you should write for this assignment is the
Status class, which handles the mechanics of processing
guesses given by the user and displaying the hidden and revealed
letters from the word. (The provided code already handles receiving
guesses from the user and displaying those guessed letters that
are wrong.) It should be a subclass of GLabel with the
following constructor and methods.
Status()(Constructor) Creates a blank word. The target word is as yet unspecified.
void setTarget(String value)Sets the target word remembered to value
and resets the displayed letters to be a string with as many dashes
('-') as letters in value.
void guess(String letter)For each occurrence of letter in the
target word, the corresponding position in the displayed letters
is revealed.
int getMissingCount()Returns the number of dashes ('-') among the revealed letters.
void showAll()Reveals all letters from the target word.
Once you have finished Status, you should have a
complete, working Hangman program.