Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Objects (Retired) Creating the MVP Current Progress

David Hinton
David Hinton
3,070 Points

Current Progress

I feel like I have been following the video very closely but i'm getting this error when it comes to compile

treehouse:~/workspace$ javac Hangman.java && java Hangman
./Prompter.java:18: error: cannot find symbol
System.out.printf("Try to solve: %s\n", mGame.getCurrentProgress());
^
symbol: method getCurrentProgress()
location: variable mGame of type Game
1 error

my code is

import java.io.Console;

public class Prompter {
  private Game mGame;

  public Prompter(Game game) {
    mGame = game;
  }

  public boolean promptForGuess() {
    Console console = System.console();
    String guessAsString = console.readLine("Enter a letter:  ");
    char guess = guessAsString.charAt(0);
    return mGame.applyGuess(guess);
}

  public void displayProgress() {
    System.out.printf("Try to solve: %s\n", mGame.getCurrentProgress());
}
}

2 Answers

Tristan Smith
Tristan Smith
3,171 Points

Hi David, it looks like you're missing the getCurrentProgress method in your class.

When you get these kind of errors, make sure to check a few things:

  1. Is it spelled correctly?
  2. If it's in another package, has that package been imported?
  3. Has it been created yet?

There's more I'm sure, but those are some basic examples.

If you go back to the video he begins to write that particular method starting at 3 minutes. [1]

Hope this helps!

[1] https://teamtreehouse.com/library/java-objects/creating-the-mvp/current-progress

David Hinton
David Hinton
3,070 Points

Hi thanks for your reply! I started again from scratch and it seemed to work perfectly thank you. The bad thing is I have to go over the videos a fair few times then also find myself on the forums looking at other people explaining the answer, don't seem to take it in quick from the videos :(

Tristan Smith
Tristan Smith
3,171 Points

That happens to me too. You're not alone. :-)

Have you tried adjusting the video speed?

If I find myself not figuring something out from a vid, I'll rewind and pause it for a few moments and as Craig says "[...]walk through it", go line by line figuring out what each does, that really helps.

David Hinton
David Hinton
3,070 Points

You know what i'll give that a try , so I can follow it more carefully! thanks :)