consider a class that could be used to play a


Consider a class that could be used to play a game of hangman. The class has the following attributes:

  • The secret word
  • The disguised word, in which each unknown letter in the secret word is replaced with a question mark (?). For example, if the secret word is abracadabra, and the letters a , and b have been guessed, the disguised word would be ab?a?a?ab?a
  • The number of guesses made
  • The number of incorrect guesses

It will have the following methods:

  • MakeGuess(c) guesses that character c is in the word
  • getDisguisedWord returns a string containing correctly guessed letters in their correct positions and unknown letters replaced with ?
  • getSecretWord returns the secret word
  • getGuessCount returns the number of guesses made
  • isFound returns true if the hidden word has been discovered.

Perform the following actions:

  • Write a method heading for each method.
  • Write preconditions and postconditions for each method.
  • Write some Java statements that test the class.
  • Implement the class.
  • List any additional methods and attributes needed in the implementation that were not listed in the original design. List any other changes made to the original design.
  • Write a program that implements the game of handgman, using the class you wrote for part d.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: consider a class that could be used to play a
Reference No:- TGS0501343

Expected delivery within 24 Hours