Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSandy Woods
1,082 PointsWorkspaces help
I got the code to compile but I'm unable to get it to work in the same fashion as Craig did. e It should, @ this stage of the game, allow me to guess a letter, determine if it's right (by putting the letter in the correct place) or wrong, notify me as to how many attempts I have left, and if I guess (hit enter) w/out guessing a letter, it will say "No letter found". @ the moment, it repeatedly ask me to guess a letter and says I have 7 attempts each time. Even when I guess a letter that's in the word, it doesn't add it to the word, it just continues to ask me to guess a letter. I'm going to post to in the treehouse community as well
2 Answers
Esther Strom
8,028 PointsI'm not positive, but I think it may be that you have spaces in places that java doesn't like them - like between a function name and the parameter list.
In Hangman.java:
Game game = new Game ("dickymeat");
should be
Game game = new Game("dickymeat");
In Game.java:
throw new IllegalArgumentException ("A letter is required");
should be (line 15)
throw new IllegalArgumentException("A letter is required");
line 25:
throw new IllegalArgumentException (letter + " has already been guessed");
should be
throw new IllegalArgumentException(letter + " has already been guessed");
lines 30-31:
public boolean applyGuess (char letter){
letter = validateGuess (letter);
should be
public boolean applyGuess(char letter){
letter = validateGuess(letter);
In Prompter.java:
public Prompter (Game game){
should be
public Prompter(Game game){
Sandy Woods
1,082 PointsThanks a lot for that tip Ester. It's still having the same issue. I'll probably continue through the Java module and come back to it and address the issue when I've finished