Milestone Four Create the ShoutBox class for your Virtual World. Your ShoutBox class will have two methods
Milestone Four
Create the ShoutBox class for your Virtual World. Your ShoutBox class will have two methods:
Method shoutOutCannedMessage() will return type String. The shoutOutCannedMessage will use an an ArrayList to store 10 messages of type String. Use a HashMap for the data structure. You can load this data structure with 10 messages of your choosing. Initialize your ArrayList with the messages. shoutOutCannedMessage() will loop through the data structure to first display all canned messages and allow the user to select one. The shoutOutCannedMessage() will return the selected message String.
Method shoutOutRandomMessage() will return type String.
The shoutOutRandomMessage() will use several Arrays or an ArrayList to store words. You will have one data structure that holds a list of words that are Subjects, another data structure that holds a list of words that are Objects, another that holds a list of Verbs, another that holds a list of Adverbs, and another that holds a list of Adjectives. Initialize your data structures with words.
The shoutOutRandomMessage() method will use a random number generator that selects one word from each data structure to form a random message. The shoutOutRandomMessage() method will return the random message as a String data type. Random messages will be of the form: Subject – Verb – Adjective – Object – Adverb. Document your shoutOutRandomMessage() method to explain the code.