Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage 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 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

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

=+ Should the MNE belong (why, why not)?

Answered: 1 week ago