Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Lab 16 Secret Word Game! objective: Write a class that will be used by a program driver to play a word guessing game.

In Java
image text in transcribed
image text in transcribed
Lab 16 Secret Word Game! objective: Write a class that will be used by a program driver to play a word guessing game. This game works similar to, "Hangman" where the player only has 5 tries to guess the word. They enter in a letter at a time and those letters are revealed in the word. Unlike hangman each turn counts and not just every time they pick a letter that's not in the word. First download the driver, and place it into the source folder (src) of your project. Next create a class called SecretWord This class has three instance variables o secretWord: the word the user has to guess o hintWord: the word with the guess letters revealed o numberOfTurns: keeps track of the number of guesses This class only requires a default constructor o You set the secret word o Number of turns to a default value of 0 The hint word is constructed using asterisk for every letter that's in the secret word Accessors for every instance variable Mutators for every instance variable o CHECK FOR VALID VALUES! Other methods o guess Letter: This method returns nothing and requires a single character parameter. The whenever the letter is found in the secret word, then that letter replaces that a in the hint word. HINT: The string method toCharArray may be very useful

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

Step: 3

blur-text-image

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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

Students also viewed these Databases questions

Question

Developing and delivering learning that is integrated with the job.

Answered: 1 week ago