The purpose of this lab is to better prepare you for your next visit to the Ohio Renaissance Festival this coming fall… you HAVE already been there before, HAVEN’T YOU? You will create a program to randomly create Shakespearian insults. The input to this is a file named insult.txt. The format looks like this:
artless base-court apple-john
bawdy bat-fowling baggage
beslubbering beef-witted barnacle
bootless beetle-headed bladder
churlish boil-brained boar-pig
cockered clapper-clawed bugbear
clouted clay-brained bum-bailey
craven common-kissing canker-blossom
currish crook-pated clack-dish
dankish dismal-dreaming clotpole
Create an object class that will open the file name passed in the constructor call, read one line at a time into a string and then use the StringTokenizer class to break the line into three words, the first word going into one Vector, the second word going into a second Vector and the last word into a third Vector, all located in this class object call cat. If, for example, you had Vectors a, b and c, a would hold the string “artless b0] would hold the string “base-court” d c0] would hold the string “apple-john”. This will all be done in the constructor for class cat. There will be one more object method in cat… get(), which will randomly Vectorsult by randomly gathering one word from each of the three Vectors. Some examples:
dankish sheep-biting death-token
churlish rude-growing canker-blossom
mangled hedge-born clotpole
spongy idle-headed mumble-news
mewling motley-minded joithead
qualling rough-hewn gudgeon
Notice that a space has been added between the first and second and between the second and third words in the phrase. Please add the word Thou in front of the whole mess to produce the following output:
Thou craven boil-brained clack-dish
Add a main() method to this object class. This will also have a menu with two optons, one to display one insult and one to exit. Formatting is your choice. I have inspected the entire insult.txt file and found nothing that should be upsetting to a 21st century college student. Feel free, however, delete any lines in the file that you deem inappropriate. You must keep at least 20 lines of the file. Please do NOT alter any lines in the file. I do not want anyone offended when they run your program as part of the grading process.
I have provided information on the use of the random function and text file input in class. This and the StringTokenizer class reference will give you sufficient information to generate the arrays of words from which you will build the insult.
You will need the following import statement in your application:
import java.util.*;