AVA (for the most part, I don't know how to add random words from the txt. files to the angle brackets. The rest below is the original assignment followed by example)
JAVA (for the most part, I don't know how to add random words from the txt. files to the angle brackets. The rest below is the original assignment followed by example)
This program generates random stories using wordlists you
supply. It starts from a base story that contains place-
holders, which appear in <angle brackets>. The allowed
placeholders are singnoun, plunoun, singverb, pluverb,
pastverb, adj, and adv. The base stories come from files
named story#.txt, where # would be replaced by 1, 2, etc.
Substituting for the placeholders would be words that come
from wordlists. The wordlists must be named noun.txt (for
singular nouns), nouns.txt (for plural nouns), verb.txt
(for singular verbs), verbs.txt (for plural verbs),
verbed.txt (for past-tense verbs), adj.txt (for adjectives)
and adv.txt (for adverbs). All these files - the story files
and the word lists, must be located in the same folder. You
will begin by selecting a story number, and then I'll take
it from there, generating a random story for you to enjoy.
Enter a story number, i to see instructions, or q to quit: 1
Here is your Madlib!
There was once a moist tiger who screamed in a mouse.
Everyone in the peasant was lopsided of the rickety house,
but no one had the locusts to love. So we testily cried
past the dog and praised upon the downtrodden feelings,
and everyone felt dark about their lot in life, until, of course,
the feelings descended upon us like voices and took destiny
from us. Rue that day! Rue it exuberantly.
txt file story
There was once a <adj> <singnoun> who <pastverb> in a <singnoun>.
Everyone in the <singnoun> was <adj> of the <adj> <singnoun>,
but no one had the <plunoun> to <pluverb>. So we <adv> <pastverb>
past the <singnoun> and <pastverb> upon the <adj> <plunoun>,
and everyone felt <adj> about their lot in life, until, of course,
the <plunoun> descended upon us like <plunoun> and took <singnoun>
from us. Rue that day! Rue it <adv>.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images