I have a string array holding words that I am converting to a char array. Also, I am taking users input as a string, then converting it to a char and adding it to an array. I am trying to check user input against the word and if it matches just println correct or incorrect. I am not certain how to code it.
private String[] wordsForGuessing = new String[] {"one", "david",
"storage", "unhelpful"};
private String ranWord = randomWord(wordsForGuessing);
private char[] convertRanWordToACharArray = ranWord.toCharArray();
private int MAX_SIZE = countsHowManyLettersAreInAWord(ranWord);
//adding three extra turns to guess
private char[] letter = new char[MAX_SIZE + 3];
private String guess;
//Check user input to see if the letter is in the word
private void checkUserInputToRanWord(char[] word, String guess)
{
String message = "This is ";
for(int i = 0; i < word.length; i++)
{
if(guess.charAt(0) == word[i])
{
message += " correct guess";
}else{
message += " incorrect guess";
}
}
}