Question: without string buffer and io exception Enhance the Number Guessing Game program from the exercises, changing it to a Guess the Letter game. 1. Ask

without string buffer and io exception Enhance the Number Guessing Game programwithout string buffer and io exception

Enhance the Number Guessing Game program from the exercises, changing it to a Guess the Letter" game. 1. Ask the user for a phrase, at least 5 characters in length; example: "Dogs always wag their tails" and remove the spaces in the string (use the String method .replaceAll(" "."")) With the length L of the string, calculate a random character position P, and the number of chances C to guess the number (C-L+5); example: string length L-23, P is random valuefrom 1.23, C-23-5-28 2. 3. Loop while the user has not guessed the correct character and number of chances C has not run out a. For each time the user guesses, i. If the guess is correct, the program displays, "Congrats! You guessed correctly in N guesses" where N is the number of guesses (loops) that have occurred; and the loop stops - ii. If the guess is incorrect, the program displays, Try again. You have only R guesses remaining" where R the number of remaining guesses (R C-number of guess (loops) so far) 4. If the user is unable to guess within the C number of chances, the program displays, "Too bad. You had C chances and did not find the letter. The letter was X" where Xis the character at position P. Hints: a) if the string has repeated letters (ex: "balloon"), that's okay and it gives the player a better chance of guessing! b) the String methods are always useful : charAt0. .toUpperCase0, lengthO, .replaceAllO, etc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!