Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2a) Method to check if the guess is valid Write a method isValidGuess that takes as input a character representing the guess made by the
2a) Method to check if the guess is valid Write a method isValidGuess that takes as input a character representing the guess made by the player. The method returns true if such character is a lower-case letter of the English alphabet, false otherwise. For example: sValidGuess (g" ) returns true isValidGuess ('B') returns false . isValidGuess'') returns false 2b) Method to generate the array of guesses Write a method generateArrayOfGuesses that takes as input a String representing the word to be guessed. The method returns an array of integers that the program will use to keep track of which character of the String has already been guessed by the player. At the very beginning none of the characters were guessed. To do so the method returns an array that has as many elements as the number of characters in the specified String. To indicate that none of the characters has been guessed yet, all the elements are initialized with value equal to 0. So, for example, generateArrayOfGuesses ("pineapple") returns the array {0, 0, 0, 0, 0, 0, 0, 0, 0}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started