Question: Need To Be in JAVA the code needs to be finished GamePlay.java import java.util.*; /** * Write a description of class GamePlay here. * *
Need To Be in JAVA
the code needs to be finished

GamePlay.java
import java.util.*;
/**
* Write a description of class GamePlay here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class GamePlay
{
public static void main(String[ ] args)
{
Scanner in = new Scanner(System.in);
char guess;
GameWord myPhrase = new GameWord("one day at a time" );
boolean [ ] used = new boolean[255];
System.out.println(" " + myPhrase.toString( ));
while(!myPhrase.checkWin( ) && ! myPhrase.getGameOver( ))
{
do{
System.out.print(" Enter your character: ");
guess = in.nextLine( ).charAt(0);
if(used[guess]) System.out.println("That letter already
guessed.");
}while (used[guess]);
used[guess] = true;
myPhrase.find(guess);
System.out.println(" " + myPhrase.toString( ));
}
if(myPhrase.checkWin( ))
{
System.out.println("You got it!");
}
System.out.println("Game Over");
System.out.println("Game Over");
System.out.println("Game Over");
System.out.println("Game Over");
}
}
GameWord.java
/**
* Write a description of class GameWord here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class GameWord
{
private String phrase;
private StringBuilder inProgress;
private int numberWrongGuesses;
private StringBuilder state;
private boolean gameOver;
public GameWord( )
{
inProgress = new StringBuilder( );
phrase = new String( );
numberWrongGuesses = 0;
state = new StringBuilder( );
gameOver = false;
}
public GameWord(String phraseToGuess)
{
phrase = new String(phraseToGuess);
state = new StringBuilder( );
inProgress = new StringBuilder( );
for(int k = 0; k
{
inProgress.append( "_ ");
}
numberWrongGuesses = 0;
gameOver = false;
}
public void setPhrase(String phraseToGuess)
{
phrase = new String(phraseToGuess);
state = new StringBuilder( );
inProgress = new StringBuilder( );
for(int k = 0; k
{
inProgress.append( "_ ");
}
numberWrongGuesses = 0;
state = new StringBuilder( );
gameOver = false;
}
public boolean getGameOver( )
{
//write the code for this get method
}
public void find(char symbol)
{
int count = 0;
int pos = 0;
pos = phrase.indexOf(symbol);
while(pos != -1)
{
count++;
inProgress.setCharAt(pos*2,symbol);
pos = phrase.indexOf(symbol, pos + 1);;
}
if(count == 0)
{
numberWrongGuesses++;
updateState( );
}
}
public boolean checkWin( )
{
boolean match = true;
//write the loop that checks to see
//if all the characters have been
//guessed
{
}
return match;
}
private void updateState( )
{
switch(numberWrongGuesses)
{
case 1: state.append(" \t\t\t\t\t 0");
break;
case 2: state.append( " \t\t\t\t /");
break;
case 3: state.append(" |");
break;
case 4: state.append( " \\");
break;
case 5: state.append(" \t\t\t\t |");
break;
case 6: state.append(" \t\t\t\t /");
break;
case 7: state.append(" \\ \t\t\t\t OH NO!! ");
gameOver = true;
}
}
public String toString( )
{
return new String(" *************************************** "
+ inProgress + " " + state.toString( ));
}
}
document the code that is in both classes with javadoc and inline comments complete the missing code in the methods as indicated improve the code by adding the following features o Create five text files using a simple text editor like Notepad each containing twenty phrases. Each file must contain phrases of a different category, such as "Famous Benjamin Franklin quotes" or "Oscar winning movies" o in main() present the user the option of which category to use for the secret phrase o open the appropriate text file and select a random line from the text file. Do NOT read the entire file contents into the program using an array of ArrayList o once the game is won or lost, give the user to play another time until they decide to quit Extra features will earn extra credit ie: a point system for competition with multiple players, a cost for incorrect guesses... If you add extra feature be sure to type that in the comments section of the Canvas submission page Submit ALL the code needed to make the project run, including your five text files Remember, documentation counts for 20 points of the grade, this include documenting the code I provided The code must run to get any credit. document the code that is in both classes with javadoc and inline comments complete the missing code in the methods as indicated improve the code by adding the following features o Create five text files using a simple text editor like Notepad each containing twenty phrases. Each file must contain phrases of a different category, such as "Famous Benjamin Franklin quotes" or "Oscar winning movies" o in main() present the user the option of which category to use for the secret phrase o open the appropriate text file and select a random line from the text file. Do NOT read the entire file contents into the program using an array of ArrayList o once the game is won or lost, give the user to play another time until they decide to quit Extra features will earn extra credit ie: a point system for competition with multiple players, a cost for incorrect guesses... If you add extra feature be sure to type that in the comments section of the Canvas submission page Submit ALL the code needed to make the project run, including your five text files Remember, documentation counts for 20 points of the grade, this include documenting the code I provided The code must run to get any credit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
