Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rules of Word Guess If the player makes five incorrect guesses (misses), the player loses. Player can only guess one letter at time. If a

Rules of Word Guess

If the player makes five incorrect guesses (misses), the player loses.

Player can only guess one letter at time.

If a player guesses a letter that occurs in the secret word multiple times, each occurrence of the letter is revealed.

Game Play

As long as the player has made fewer than five misses and has not guessed all the letters in the word:

Print a line reporting the current missed letters and the number of remaining misses before the player loses.

Print a line reporting the current guess with underscores, '_', for letters which havent yet been guessed.

Print a prompt for the user to enter a letter on the same line as the prompt.

Read a letter from the console.

Update the current guess and the number of misses accordingly.

Print a line reporting all the letters the player missed in the game.

Print a line reporting the final guess, including '_' characters for letters that werent guessed.

If the player lost, print a line saying Sorry, too many missess. and what the secret word was.

If the player won, print a line saying Congratulations! You got it! (the full secret word will have already been printed).

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899