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 Delivering the MVP Validating and Normalizing User Input

NormalizeGuess does not seem to be working even though code compiles.

I've have followed the video and went back to check a couple of times but cant find any error. My code also compiles without any issues however when playing the hangman game it does'nt convert uppercase to lowercase and it will accept a number as input so i think there should be something wrong in the normalizeGuess part of my code but i can't seem to find out what.

Here is a link to my code: https://w.trhou.se/273x6ebdw9

1 Answer

Justin Horner
Justin Horner
Treehouse Guest Teacher

Hello, anjo van der ploeg

I created a fork of the Workspace and found that I was not able to compile successfully due to the following line in Prompter.java. The reason is that System.out.println only accepts one parameter, while here we need to pass two parameters.

System.out.println("%s. Please try again. %n", iae.getMessage());

You need to change from println to printf to use the formatted string.

System.out.printf("%s. Please try again. %n", iae.getMessage());

After making this change, the code seemed to be working as expected in my tests when I provided integers and capital letters as answers.

I hope this helps. Take care.