Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

What are the advantages and disadvantages of leasing ?

Answered: 1 week ago

Question

Name is needed for identifying organisms ?

Answered: 1 week ago