Java program language

RiverFlowsInYou
2.docx

You will use your Markov table from the previous step in this assignment to write a full Markov text generator. To generate Markov text, you must:

 

1. Pull an arbitrary key out of the Markov table

2. Pull a value at random from the ArrayList of values associated with that key

3. Print the value

4. Search for a new key, consisting of every word from the previous key except the first key, and with the value added to the end of the key.

5. Print a value at random associated with this new key

6. Repeat until a sufficient number of Markov words has been generated.

Your main function should ask for a number of words to generate, and then use the Markov table from the previous exercise -- using the same source text as in that exercise -- to generate that number of words.