Question: Java string question: Create a two-player game with the following functionality: Player 1 enters a crossword clue, and the answer Convert the answer to upper

Java string question:

  • Create a two-player game with the following functionality:
  • Player 1 enters a crossword clue, and the answer
  • Convert the answer to upper case.
  • Clue: "Where chemists mix chemicals or programmers learn to code" Answer: "LABORATORY"
  • Clear the terminal by printing some extra lines of whitespace
  • Player 2 is shown the crossword clue, with the letters replaced with underscores and with spaces between the letters.
  • Fill in the letters R S T L N E anywhere they appear in the clue, e.g.
  • Clue: "Where chemists mix chemicals or programmers learn to code" Answer: "L _ _ _ R _ T _ R _"
  • Player 2 then picks three more consonants and a vowel
    • Perform some error checking here to ensure the correct number of letters were entered, and that the first three letters are consonants and the last letter is a vowel, and check to make sure no duplicate letters
  • Fill in the word with those letters included:
  • Choose three consonants and a vowel: CBFO Clue: "Where chemists mix chemicals or programmers learn to code" Answer: "L _ B O R _ T O R _"
  • Player 2 then gets three guesses to figure out the word.
  • Inform the player if they guessed correctly after each guess, and if so, end the game.

Use:

Java Scanner

Java StringBuilder

string functions: toUpperCase; contains; charAt; equals

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!