I am not totaly sure my code for my revealLetter is correct....I can't quite convert letter string into an char array so i just left it as hiddenWord == letter in the code....
package program.p02;
public class WordHider {
private String hiddenWord;
private String partiallyFoundWord;
private int NUMBER_MISSES = 5;
public int revealLetter(String letter) {
//reveals letter stored in the parameterized string.
int numOfTimesLetterAppears = 0;
for (int i = 0; i < hiddenWord.length(); i++) {
//compare letter of hiddenWord at i with letter
//String s = new String(hiddenWord.charAt(i));
if (hiddenWord == letter){
//partiallyFoundWord[i] = letter; // changes astrix to letter
numOfTimesLetterAppears++; //increment
}//end if
}//end for loop
return numOfTimesLetterAppears;
}//end revealLetter()
public boolean wordFound() {
//checking to see if word is guessed or not
if (NUMBER_MISSES > 5) {
System.out.println("You Lose. Try Again.");
return true;
}//end if
else {
System.out.println("Yay");
}//end else
return false;
}//end wordFound()
public void hideWord(char[] charArrray) {
//resets partiallyFoundWord to all asterisks.
char[] charArray = new char[hiddenWord.length()];
for (int i = 0; i < hiddenWord.length(); i++) {
charArrray[i] = '*';
partiallyFoundWord = new String(charArray);
}//end for loop
}//end hideWord()
public String getHiddenWord() {
return hiddenWord;
}//end getHiddenWord()
public void setHiddenWord(String hiddenWord) {
}//end setHiddenWord()
public String getPartiallyFoundWord() {
return partiallyFoundWord;
}//end getPartiallyFoundWord()
}//end WordHider class