Question: 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

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

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!