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 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
STAFF
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.