Imani G.

asked • 09/15/23

java method getUserGuess

Method name: getUserGuess

Parameter(s): a Scanner object

Return type: String

Purpose: This method asks the user for a 5-letter word and returns the word. This method must repeatedly ask for a word until the string given as input contains exactly five characters.

Notes:

  1. This method must print a prompt asking the user for a word and repeat that prompt, as needed, each time the user must input another word.
  2. Assume the user inputs only lowercase letters.
  3. Use Scanner object (the parameter) to get the user's input. Do not create another Scanner object in this method.


1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.