Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 hint Word: the word with the guess letters revealed o numberof Turns: 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 o 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 guessLetter: 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 asterisk 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started