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 trial

Java Java Objects Creating the MVP Current Progress

erwin ramos
erwin ramos
2,092 Points

I need help with errors in code please!

Hangman.java:7: error: cannot find symbol
prompter.displayProgress();
^
symbol: method displayProgress()
location: variable prompter of type Prompter
Hangman.java:15: error: cannot find symbol
prompter.displayProgress();
^
symbol: method displayProgress()
location: variable prompter of type Prompter
./Prompter.java:19: error: cannot find symbol
System.out.printf("try to solve : %s %n", game.getCurrentProgess());
^
symbol: method getCurrentProgess()
location: variable game of type Game
3 errors

HANGMAN CLASS-----

public class Hangman {

public static void main(String[] args) { // Your incredible code goes here... Game game = new Game("treehouse"); Prompter prompter = new Prompter(game); prompter.displayProgress(); boolean isHit = prompter.promptForGuess(); if (isHit){ System.out.println("We've got a hit!"); } else{ System.out.println("Oops that's a miss"); } prompter.displayProgress(); }

}


PROMPTER CLASS

import java.util.Scanner;

class Prompter{ private Game game;

public Prompter(Game game){ this.game=game; }

public boolean promptForGuess(){ Scanner scanner = new Scanner(System.in); System.out.print("Enter a letter: "); String guessInput = scanner.nextLine(); char guess = guessInput.charAt(0); return game.applyGuess(guess);

} public void displayProgess(){ System.out.printf("try to solve : %s %n", game.getCurrentProgess());

} }

1 Answer

Anders Björkland
Anders Björkland
7,481 Points

Hi,
It seems like you misspelled progress in your Prompter class. Take a second look at your displayProgress-method, or should I say displayProgess? ;)