/**
 * @file TreeStory.java
 * @author Valery Samovich
 * @version 1
 * @date 2015/05/11
 */

package com.samovich.basics.concepts.strings.treehouse;

import java.io.Console;
import java.util.Scanner;

public class TreeStory {

    public static void main(String[] args) {
        // __Name__ is a __adjective__ __noun__.
        // They are always __adverb__ __verb__.

        // Console console = System.console();
        // String name = console.readLine("Enter a name:  ");
        // String adjective = console.readLine("Enter an adjective:  ");
        // String noun = console.readLine("Enter a noun:  ");
        // String adverb = console.readLine("Enter an adverb:  ");
        // String verb = console.readLine("Enter a verb ending with -ing:  ");
        // console.printf("Your TreeStory:\n----------------\n");
        // console.printf("%s is a $s %s. ", name, adjective, noun);
        // console.printf("They are always %s %s.\n", adverb, verb);

        Scanner scanner = new Scanner(System.in);
        System.out.println("How old are you? ");
        String ageScanner = scanner.nextLine();

        int age = Integer.parseInt(ageScanner);
        if (age < 13) {
            // Insert exit code
            System.out.println("You must be at least 13 to use this program.\n");
            System.exit(0);
        }
        // Scanner scanner = new Scanner(System.in);
        System.out.println("Enter a name:  ");
        String name = scanner.nextLine();
        System.out.println("Enter an adjective:  ");
        String adjective = scanner.nextLine();
        System.out.println("Enter a noun: ");
        String noun = scanner.nextLine();
        System.out.println("Enter an adverb: ");
        String adverb = scanner.nextLine();
        System.out.println("Enter a verb ending with -ing:  ");
        String verb = scanner.nextLine();
        // Print the prototype
        System.out.println("Your TreeStory:\n-------------------------\n");
        System.out.println(name + " is a " + adjective + " " + noun + ".");
        System.out.println("He is always " + adverb + " " + verb + ".");
    }
}

@@ -955,24 +955,61 @@
 rb, verb);%0A%0A
+        // Create the scanner object%0A
         Scan
@@ -1091,24 +1091,68 @@
 re you? %22);%0A
+        // Convert and store age as integer%0A
         Stri
@@ -1236,16 +1236,43 @@
 anner);%0A
+        // Age validation.%0A
         
@@ -1306,16 +1306,9 @@
  // 
-Insert e
+E
 xit 
@@ -1436,60 +1436,8 @@
   %7D%0A
-        // Scanner scanner = new Scanner(System.in);
 %0A   
@@ -1472,32 +1472,70 @@
 er a name:  %22);%0A
+        // Accept user input for name%0A
         String n
@@ -1652,32 +1652,33 @@
 ner.nextLine();%0A
+%0A
         System.o
@@ -1741,32 +1741,222 @@
 ner.nextLine();%0A
+        // Noun validation.%0A        if(noun.equalsIgnoreCase(%22dork%22)) %7B%0A            System.out.println(%22This language is not allowed. Exiting. %5Cn%5Cn%22);%0A            System.exit(0);%0A        %7D%0A%0A
         System.o
@@ -2224,35 +2224,24 @@
 ------------
------------
 %5Cn%22);%0A      

Add javadoc and noun validation