/* This is the skeleton of a program to generate free style poetry. Read it carefully and understand what each function does, and how all functions work together to generate verses and stanzas. There is (just) one rule for generating a verse: verse ==> 'The' adjective noun verb adjective object Your task is to extend this program to generate better poetry. For instance, you could add more words to the word lists, add more word lists (prepositions, interjections, et cetera), add different rules for creating verses, add rhyme, do not use the same word twice in a verse, add stanzas with different number of verses, add more stanzas, et cetera. This are just some examples, use your imagination!! Laura Toma csci 101 */  import java.util.Random; public class Poet { //lists of words static String [] verblist = {"walks", "eats", "sleeps", "works", "studies"}; static String [] nounlist = {"student", "professor"}; static String [] pronounlist = {"i", "you"}; static String [] adjlist = {"pretty", "smart", "fun"}; static String [] objlist = {"flowers", "books"}; static Random rand = new Random(); // a random number generator /* parameters: a list of words 'list' is given action: return a random word from the list of words */ static String word(String [] list) { //s is a random number in the range 0 to n-1 int s = rand.nextInt(list.length); //print the s-th word from the list of words return list[s] + " "; } //action: return a random verb from verblist static String verb() { return word(verblist); } //action: return a random noun from nounlist static String noun() { return word(nounlist); } //action: return a random pronoun from pronounlist static String pronoun() { return word(pronounlist); } //action: return a random adjective from adjlist static String adjective() { return word(adjlist); } //action: return a random object from objlist static String object() { return word(objlist); } //action: print a verse static void printVerse() { // formula for a verse is // verse ==> 'The' adjective noun verb adjective object System.out.println("The " + adjective() + noun() + verb() + adjective() + object()); } //action: generate a stanza static void stanza() { int i=0; // stanza of 4 verses while (i<4) { printVerse(); i++; } System.out.println(); } public static void main (String args[]) { //generate one stanza stanza(); } } // end of class