Explore BrainMass
Share

Explore BrainMass

    ShoutBox - Java Example

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    You will create the ShoutBox class for your Virtual World. Your ShoutBox class will have a shoutOutCannedMessage() method that returns a String type. The shoutOutCannedMessage will use an Array or an ArrayList to store 10 messages of type String. For those of you that are more advanced with your Java skills, you could use a HashMap for the data structure. You can load this data structure with 10 messages of your choosing. For example, one message could be "I need Java!" You can initialize your Array or ArrayList with the messages or have the user enter the messages. The choice is yours. The 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. Take a screenshot to verify that the selected message String is displayed successfully. Cut and paste the screenshot into a Word document and attach this document to your submission.

    Submit your .java file as one zipped folder.

    For additional details, please refer to the Module Seven User-Defined Methods Rubric document in the Assignment Guidelines and Rubrics section of the course.

    Note: At their discretion, instructors may perform an originality check on submissions using Turnitin.

    © BrainMass Inc. brainmass.com October 10, 2019, 8:10 am ad1c9bdddf
    https://brainmass.com/computer-science/java/shoutbox-java-example-611186

    Solution Preview

    Hi there,

    Attached you will find a ShoutBox.java file containing shoutOutCannedMessage() method. The code is working as requested ...

    Solution Summary

    The code is very simple and easy to understand, written in Java. It has a ShoutBox class with a method by the name of shoutOutCannedMessage() to display 10 messages stored in an array list. First it display those messages using a for loop and then asks the user to input a message number to display that chosen message. Using if..else check it determines the user input and returns the requested method. The code can easily be modified. Two files are attached - ShoutBox.java and a screen shot of the code in action.

    $2.19