Random Sentence Generator

Run the console app with javac RandomSentenceGenerator.java && java RandomSentenceGenerator. When prompted for a target, try entering SENTENCE. If everything goes well, you should see the following output appear.

Valid symbols: SENTENCE NOUNP PROPNOUN ADJS ADJ DET NOUN VERBP TRANSVERB INTRANSVERB
Target: SENTENCE
the faulty pretentious university wept
a big child wept
Elmo collapsed
a big faulty subliminal cat honored Elmo
the pretentious cat collapsed
John laughed
Fred laughed
the green university laughed
the faulty mother helped a wonderful subliminal wonderful subliminal man
Fred helped John

Target:

Modify the web app

Now, let’s fill in step 1 and 2 for the Random Sentence Generator. This app should generate English sentences when given the target SENTENCE. Modify the Server.java file to implement step 1 and 2.

Note
For step 2, call randomChoice to pick one random element from a collection of elements.

Run the web app with javac Server.java && java Server. In a web browser, navigate the following address: localhost:8000.

Then, try clicking on the ⚡ (lightning bolt) icon and see what happens.

When you’re done demoing the web app, stop the Java terminal process with Ctrl+C.