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 trialCharles Harpke
33,986 Pointserror in the prompter class.
I get the following error:
System.out.printf(Bummer the word was %s. :(\n",
symbol: class word location : class Prompter ./Prompter.java20: error:cannot find symbol m.Game.getAnswer());
symbol: method getAnswer() location: class Prompter 14 errors here is my code:
import java.io.Console;
public class Prompter {
private Game mGame;
public Prompter(Game game) {
mGame = game;
}
public void play() {
while (mGame.getRemainingTries() > 0 && !mGame.isSolved()) {
displayProgress();
promptForGuess();
}
if (m.Game.isSolved()) {
System.out.printf("Congratulations you won with %d tries remaining.\n",
mGame.getRemainingTries());
} else {
System.out.printf(Bummer the word was %s. :(\n",
mGame.getAnswer());
}
}
public boolean promptForGuess() {
Console console = System.console();
boolean isHit = false;
boolean isValidGuess = false;
while (! isValidGuess) {
String guessAsString = console.readLine("Enter a letter: ");
try {
isHit = mGame.applyGuess(guessAsString);
isValidGuess = true;
} catch (IllegalArgumentException iae) {
console.printf("%s. Please try again.\n", iae.getMessage());
}
}
return isHit;
}
public void displayProgress() {
System.out.printf("You have %d tries left to solve: %s\n",
mGame.getRemainingTries(),
mGame.getCurrentProgress());
}
}
2 Answers
Ken Alger
Treehouse TeacherCharles;
Did you get this solved with your second post and the addition of the other double quote?
Ken
Charles Harpke
33,986 PointsYes...I see the code posted earlier...
Charles Harpke
33,986 PointsCharles Harpke
33,986 Points