how would a class file and main file Java program be written with Character, String, and String Builder in which a user guesses letters and then attempts to guess a hidden word. It would display the word using symbols. When a letter guess is made by the player the letter is added to the correct place of the word and show the word again or return a message saying the guess is not in the word. Then add a message after the word has been guessed correctly. Guesses can be one letter or a word, if it's a word then make the program check if it's the same word as hidden by the symbols. The word guessed is randomly selected by the program from a list of 3 words by creating 3 different string variables and coding a random number between 1 and 5 to select the word. A clue would be shown to player with symbols replacing the words. If only one letter is entered then find all occurrences of that letter in the word. If attempt to guess the entire word its correct, then print a positive message. And correct, then print a positive message. And ask if they want to play again. Otherwise if the guess is wrong then tell them and ask for another guess. Also if one letter is guessed and it is part of the word then show all places that letter is used in the word. Or one letter is guessed and it's not part of the word then message user it's not in the word and ask for another guess. Ask user if they want to play again after word is shown. The program should loop so after each round so the user can choose to play again and a different phrase will be selected. The user class would contain one String variable for the player's name and one integer variable for the number of guesses. Include a function in the class that can reset the number of guesses at the beginning of each round. In the main file ask the user for their name and set it in the class. After each round has been completed and a message is printed, the message would include the player's name and the number of attempts it took them to guess the word.
**************^^#}{{{{}%*+==++^#{]]]{}#^*+++++++++++++++
how would a class file and main file Java
Step by step
Solved in 3 steps with 1 images
What if there's space in between the words? How will a space be added without a symbol in the hint ?