Question: In Java, the driver in is provided in the last two pictures Lab 16 Secret Word Game! objective: Write a class that will be used
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
Get step-by-step solutions from verified subject matter experts
