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 Basics Perfecting the Prototype Censoring Words - Looping Until the Value Passes

PLEASE help me, not sure why this isn't working

I have typed in all that i should but when i put dork it won't give me another try it will quit me out

  String ageAsString = console.readLine("How old are you?  ");
      int age = Integer.parseInt(ageAsString);
      if (age < 13) {
        //Insert exit code
        console.printf("Sorry you must be at least 13 to use this program.\n");
        System.exit(0);
      }
      String name = console.readLine("Enter a name:  ");
      String adjective = console.readLine("Enter an adjective:  ");
      String noun;
      do {
         noun = console.readLine("Enter a noun:  ");
        if (noun.equalsIgnoreCase("dork")  || 
            noun.equalsIgnoreCase("jerk")) {
          console.printf("That language is not allowed.   Try again. \n\n");
         }
      } while(noun.equalsIgnoreCase("dork") || noun.equalsIgnoreCase("jerk"));        
      String adverb = console.readLine("Enter an adjective:  ");
      String verb = console.readLine("Enter a verb ending in -ing:  ");

2 Answers

Brandon Zeck
Brandon Zeck
3,127 Points

Hi Zach Graulich,<p>

I was wondering if you gave an age < 13 as your first input</p><p>

Awaiting your reply.</p><p>

Thanks</p>

Yongshuo Wang
Yongshuo Wang
5,500 Points

I have copied your code into my workspace, it works okay. Please make sure, when the system ask you to "Enter a noun", then you enter the jerk or dork.

Hope it can help you.