Working on a Hangman Game. Trying to add a guess(char variable) into char array and display a list of guessed letters. Please help this piece code isn't working
while(guessedWord.toString().equals(test.toString( )) == false && errors < 5) { System.out.print("Guess Letter: "); Scanner scan = new Scanner(System.in); guess = scan.next().charAt(0); char[] guessedLetters = new char [10]; //THE PROBLEM System.out.println(guessedLetters); //THE OTHER PROBLEM //System.out.println("Letters Already Used: "+ lettersGuessed[0]); for(int i = 0; i < guessedWord.length(); i++){ //check if letter has been guessed if(guessedWord.charAt(i) == guess) { test.setCharAt(i, guess); System.out.println(test); } } if(word.indexOf(guess) == -1 ) //if letter not in secret then errors goes up by 1 and while loop continues { errors++; } if(guessedWord.toString().equals(test.toString( )) == true) { score = (5 - errors); cum += score; System.out.println("\nYou win !!!"); System.out.println("Your cumlative score is: " + cum); initGame(); } if(errors == 5) { String name; Scanner input = new Scanner(System.in); System.out.println("\nYou lose !!!"); System.out.println("Your score is: " + cum); System.out.print("Please enter your name: "); name = input.nextLine(); myWord.setSaveScore(name, cum); cum = 0; initGame(); }