Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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,

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, b, and e 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.

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 hangman using the class you wrote for Part d.

Help needed!! this is for java

thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students explore these related Databases questions