IT 511: Final Project Guidelines and Grading Guide
Overview
Your final project for this course is the creation of a Virtual World Java application that results in a virtual world, complete with an object that will act as a human
clone. A virtual world with a human clone would not be complete without additional objects for interaction, so you will be responsible for creating a “ShoutBox”
and another object that will keep your human clone from getting lonely, and a virtual world application that will test your objects. Your final deliverables will
include your working code (which your instructor will run in order to review your virtual world) as well as an annotated version of your written code that explains
your reasoning for choices, how the code meets the given specifications for your project, how you ensured the accuracy and workability of your code, and
methods used for testing and debugging.
The project is divided into four milestones, which will be submitted at various points throughout the course to scaffold learning and ensure quality final
submissions. These milestones will be submitted in Modules Two, Five, Seven, and Eight. The final submission will be submitted in Module Nine.
In this assignment you will demonstrate your mastery of the following course outcomes:
Write simple, accurate object-oriented programs using primitive data types, variables, data structures, and object-oriented principles
Implement classes that meet the given specifications of object instance variables and behaviors
Create operative algorithms using sequential logic structures, decision control structures, and loops
Create and use methods that accept parameters and return results
Test and debug object-oriented programs for accuracy in program functionality
Document object-oriented code with comments that articulate the purpose and behavior of code for various audiences
Prompt
In creating your virtual world, you will need to create a MyClone class that will represent a virtual clone, another class that will represent a ShoutBox, and
another class of your choice. The class of your choice can be anything you want to exist in your virtual world (a cat, a bird, a computer, etc.). This project is a
prototype and there will not be any graphics, so you will create an application that unit tests the functionality of your three classes (your MyClone class, your
ShoutBox class, and the class of your choice).
Specifications for MyClone
Feel free to add additional instance variables and behaviors, but your clone object must have instance variables firstName, lastName, and an introduction()
method. The firstName and lastName instance variables will hold your first and last names. You will demonstrate your understanding of encapsulation by
protecting your instance variables by making them private and by creating getters and setter methods for all instance variables. You should have at least one
constru ...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
IT 511 Final Project Guidelines and Grading Guide Ov.docx
1. IT 511: Final Project Guidelines and Grading Guide
Overview
Your final project for this course is the creation of a Virtual
World Java application that results in a virtual world, complete
with an object that will act as a human
clone. A virtual world with a human clone would not be
complete without additional objects for interaction, so you will
be responsible for creating a “ShoutBox”
and another object that will keep your human clone from getting
lonely, and a virtual world application that will test your
objects. Your final deliverables will
include your working code (which your instructor will run in
order to review your virtual world) as well as an annotated
version of your written code that explains
your reasoning for choices, how the code meets the given
specifications for your project, how you ensured the accuracy
and workability of your code, and
methods used for testing and debugging.
The project is divided into four milestones, which will be
submitted at various points throughout the course to scaffold
learning and ensure quality final
submissions. These milestones will be submitted in Modules
Two, Five, Seven, and Eight. The final submission will be
submitted in Module Nine.
In this assignment you will demonstrate your mastery of the
following course outcomes:
2. -oriented programs using
primitive data types, variables, data structures, and object-
oriented principles
object
instance variables and behaviors
decision control structures, and loops
results
-oriented programs for accuracy in
program functionality
-oriented code with comments that articulate
the purpose and behavior of code for various audiences
Prompt
In creating your virtual world, you will need to create a
MyClone class that will represent a virtual clone, another class
that will represent a ShoutBox, and
another class of your choice. The class of your choice can be
anything you want to exist in your virtual world (a cat, a bird, a
computer, etc.). This project is a
prototype and there will not be any graphics, so you will create
an application that unit tests the functionality of your three
classes (your MyClone class, your
ShoutBox class, and the class of your choice).
Specifications for MyClone
Feel free to add additional instance variables and behaviors, but
3. your clone object must have instance variables firstName,
lastName, and an introduction()
method. The firstName and lastName instance variables will
hold your first and last names. You will demonstrate your
understanding of encapsulation by
protecting your instance variables by making them private and
by creating getters and setter methods for all instance variables.
You should have at least one
constructor created that initializes all instance variables. The
introduction() method will introduce you to the virtual world by
displaying a greeting, your full
name, and anything else you would want to say.
Partial class diagram for the MyClone object:
Specifications for ShoutBox
The ShoutBox object will allow you to shout messages into your
virtual world. Your ShoutBox will have two ways of generating
messages:
1. You can select from a list of canned messages to shout, or
2. You can have the ShoutBox generate a random message for
you.
4. You must use data structures Array, ArrayList, or a HashMap to
store the message data.
Canned messages: One data structure will store the canned
messages. You can load this data structure with canned
messages of your choosing. The
shoutOutCannedMessage() method 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. This String will be displayed in the virtual world. For
now, your virtual world will be the
output window.
Random messages: To generate random messages, you need to
have a data structure that holds a list of subjects, another data
structure that holds a list of
objects, another that holds a list of verbs, another that holds a
list of adverbs, and another that holds a list of adjectives. The
lists you create can hold as many
words as you would like. The shoutOutRandomMessage()
method will use a random number generator that selects one
word from each data structure to form a
random message. Random messages will be in the following
form: Subject - Verb - Adjective - Object – Adverb.
The generated message String will be returned. The String will
be displayed by the ShoutBox in the virtual world. For now,
your virtual world will be the output
window.
MyClone
5. -firstName
-lastName
introduction()
Partial class diagram for the ShoutBox object:
Examples of canned messages stored in the canned messages
data structure (you can store as many canned messages as you
would like):
Example of subjects stored in the subjects data structure:
“I”
“You”
Example of objects stored in the objects data structure:
6. “course”
“homework”
Example of verbs stored in the verbs data structure:
“studying”
“eating”
“sneezing”
Example of adjectives stored in the adjectives data structure:
“funny”
“prickly”
“hard”
“awesome”
Example of adverbs stored in the adverbs data structure:
ShoutBox
String shoutOutRandomMessage()
String shoutOutCannedMessage()
“Hello World”
7. “I am studying”
“I am at work”
“quickly”
“everywhere”
Specifications for Your Additional Object
You will create another object of your choosing to add to your
virtual world. Your object should have at a minimum two (2)
instance variables and one (1)
method. You will demonstrate your understanding of
encapsulation by protecting your instance variables by making
them private and by creating getters and
setter methods for all instance variables. You should have at
least one constructor created that initializes all instance
variables.
Specifications for Virtual World Application
You will create a virtual world application that will test your
MyClone, ShoutBox, and the object you decided to add to your
virtual world. Because this is a simple
prototype, you will not actually create any graphics to represent
the objects in the virtual world. Any displayed information will
simply be displayed in the
output window.
8. Submit your Java application by submitting all .java files and at
least four screenshots that demonstrate you tested the
application.
While the listed number of instance variables and methods are
the minimum number required for each class, you are free to
create additional.
Specifically, the following critical elements must be addressed:
I. Program Functionality and Alignment
a. Make sure your entire program functions correctly and that
there are no exceptions or compile errors
b. In writing your code, make sure that you are meeting or
exceeding all of the given specifications for each class.
Although you will be graded on
coverage of stated requirements, you are free to use your
creative touch in developing additional classes and objects with
additional instance
variables should you wish.
He reads red book
quickly!
c. Create the unit test application and use it to test the
functionality of each class. Submit the screenshots showing that
the code was tested.
II. Data Structure for Message Storage: Use data structures
(either Arrays, ArrayLists, or a HashMaps) to store the message
data in accordance with the
9. given specifications. You can use one type, or a mix of the
listed types of data structures for message storage. Specifically,
it should be one data structure
per word type (verb, subject, etc.), but you can choose to use a
HashMap for canned messages and maybe ArrayLists for the
use Arrays for all of them.
III. Methods and Instance variables
a. Method shoutOutCannedMessage() loops through the data
structure that stores the canned messages first to display all
canned messages and
allows the user to select one canned message.
b. The method shoutOutCannedMessage() will return the
selected message string.
c. Your shoutOutRandomMessage() method should use a random
number generator that selects one word from each data structure
to form a
random message. The random number generated should not
exceed the bounds of your data. In other words, if you only
have 5 words in a data
structure, the random number generated should not be an index
that has no word stored.
d. The method shoutOutRandomMessage() should return a
randomly generated message string in accordance with
specifications, in the form:
Subject - Verb - Adjective - Object - Adverb (for example,
“You read hard books quickly”).
e. Use the MyClone introduction() method to introduce your
clone to the virtual world by displaying a greeting, your full
10. name, and anything else
you would want to say.
f. MyClone class should include instance variables (at least
firstName and lastName) that are made private and have
associated getters (accessors)
and setters (mutators) for all instance variables.
g. You should build an additional class of your choice, which
should have at least 2 private instance variables with associated
getters (accessors) and
setters (mutators) and 1 method your choice.
IV. Test Application: You will create one application that will
test all three classes.
a. Perform a unit test of the MyClone to test all getters
(accessors) and setters (mutators)and method(s) of the class.
b. Perform a unit test of the ShoutBox to test all methods of the
class.
c. Perform a unit test of the additional class object to test all
getters (accessors) and setters (mutators) and method(s) of the
class.
V. In-Code Comments
a. Make sure your object-oriented code is accurately
documented to explain the purpose and behavior of the code.
b. Articulation of comments is clear and concise for the
audiences that may review it, including your instructor and
individuals that may need to
maintain or implement the code.
Milestones
Milestone One: MyClone Class
In Module Two, you will submit your Java class, MyClone. You
11. will create your initial version of the MyClone class. MyClone
class should have instance variables
firstName and lastName. The firstName and lastName instance
variables hold a value for first and last names respectively. You
will demonstrate your
understanding of encapsulation using the private specifier to
restrict access to your instance variables. This milestone is
graded with the Milestone One Rubric.
Feedback should be incorporated into the final project as
warranted.
Milestone Two: Message Array
In Module Five, you will submit your Java code that creates an
Array of String messages. Write an application that uses an
Array to store 10 messages of type
String. You will store this Array with 10 messages of your
choosing. For example, a message could be “I love Java the
programming language!” or another
message could be “I love Java the drink!” You may initialize
your Array with the messages or have the user enter the
messages. The choice is yours. Your Java
code will loop through the Array to iterate through your entire
list and display each message and allow the user to select one.
The shoutOutCannedMessage() will
return the selected message String. This milestone is graded
with the Milestone Two Rubric. Feedback should be
incorporated into the final project as
warranted.
Milestone Three: Programmer-Defined Class
In Module Seven, You will create a Virtual World application
as your final project. This Virtual World will have several
12. objects including a MyClone object and
another object of your choice. It would be an excellent idea to
review the Final Project Guidelines at this time. For this Third
Final Project Milestone, you will
finish development of your MyClone class and create another
class of your choice.
In Module Two, you started development of the MyClone class.
You will continue to develop the MyClone class by adding
accessor methods, mutator methods,
and an introduction() method. You will create an accessor and
mutator method for each instance variable declared in the
MyClone class. The introduction()
method will introduce yourself to the virtual world by
displaying a greeting, your first and last name, and anything
else you would want to say.
You will also create another class of your choice. Your
programmer-defined class should have at a minimum two
instance variables and one method. The instance
variables and method should be representative of the data and
behavior that objects of this class will have. You will
demonstrate your understanding of
encapsulation by declaring the instance variables as private and
by creating accessors and mutators for each instance variable.
You should have at least one
constructor created that initializes all instance variables.
Document your code. This milestone is graded with the
Milestone Three Rubric. Feedback should be
incorporated into the final project as warranted.
Milestone Four: ShoutBox Class With Methods
In Module Eight, you will 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 Array or an ArrayList
to store 10 messages of type String. For those of you who are
13. 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. 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. Document your
shoutOutCannedMessage() method to explain the code.
Method shoutOutRandomMessage() method 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. You can initialize your data structures with
words or have the user enter the words. The choice is yours.
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
following form: Subject - Verb -
Adjective - Object - Adverb.
14. Document your shoutOutRandomMessage() method to explain
the code.
This milestone is graded with the Milestone Four Rubric.
Feedback should be incorporated into the final project as
warranted.
Final Submission: Virtual World Java Application
In Module Nine, you will submit all classes for the Virtual
World Java application. It should be a complete artifact, free of
compiler and run-time errors, and
contain all of the critical elements of the final product. You will
submit the following completed classes in addition to a class
that tests them: MyClone, ShoutBox,
the class you designed, and a test class. In your test class you
will have a main() method. This test class will represent your
virtual world application that will test
the MyClone, the ShoutBox, and the class you decided to create
in Module Seven. Document your code with comments. It
should reflect the incorporation of
feedback gained throughout the course. This submission will be
graded using the Final Project Rubric.
Deliverable Milestones
Milestone Deliverables Module Due Grading
1 MyClone Class Two Graded separately; Milestone One
Rubric
2 Message Array Five Graded separately; Milestone Two
Rubric
3 Programmer-defined Class Seven Graded separately;
15. Milestone Three Rubric
4 ShoutBox Class With Methods Eight Graded separately;
Milestone Four Rubric
Final Project: Virtual World Java
Application
Nine Graded separately; Final Project Rubric
Final Project Rubric
Requirements of Submission: Written components of projects
must follow these formatting guidelines when applicable:
double spacing, 12-point Times New
Roman font, one-inch margins, and discipline-appropriate
citations.
This activity uses an integrated rubric in Blackboard. Students
can view instructor feedback in the Grade Center. For more
information, review these instructions.
Instructor Feedback: Students can find their feedback in the
Grade Center or Turnitin.
Critical Elements Exemplary (100%) Proficient (90%) Needs
Improvement (70%) Not Evident (0%) Value
Program
Functionality
16. All functional and design
requirements are met and the
user interface is friendly,
handles invalid user
interactions, displays output in
a clear format, and is intuitive
Complete program functions
correctly, with no compile
errors and no exceptions
Complete program does not
function correctly
Program is not complete 10
Program Alignment Meets “Proficient” criteria and
code includes additional
instance variables or objects
that behave according to given
specifications
Complete code meets the
specifications and minimum
requirements for each class
Code is complete, but does not
meet all of the given
specifications and minimum
requirements for each class
Code is not complete
7
17. Unit Test Application Meets “Proficient” criteria and
unit test application behaves
like a true virtual world
Unit test application accurately
tests the functionality of each
class
Unit test application tests the
functionality of each class, but
not accurately
Unit test application does not
test the functionality of each
class
7
Data Structure for
Message Storage
Meets “Proficient” criteria and
generics are used to define the
type of any ArrayList or
HashMap; initialization of data
structures are flexible (user
enters the data instead of hard
coded initialized data)
Uses an Array, ArrayList, or a
HashMap to effectively store
massage data in accordance
with the given specifications
18. Uses an Array, ArrayList, or a
HashMap to effectively store
massage data, but not in
accordance with the given
specifications
Does not use an Array,
ArrayList, or a HashMap to
effectively store massage data
6
http://snhu-
media.snhu.edu/files/production_documentation/formatting/rubr
ic_feedback_instructions_student.pdf
shoutOutCannedMes
sage() Method
Meets “Proficient” criteria
substantiated with formatted
printing used to display all
canned messages from the
shoutOutCannedMessage()
method; the user interface
provided that allows user to
select a message is robust,
handles invalid entries, and
prevents the user from entering
19. an index that is beyond the
range of the indices for the
Array; loop uses length of Array
to control loop
Method loops through the data
structure that stores the canned
messages, displays all canned
messages, and allows user to
select one; method returns the
correct selected message string
Method insufficiently loops
through the data structure that
stores the canned messages,
does not display all canned
messages, or method
insufficiently allows user to
select one message
Method does not loop through
the data structure that stores
the canned messages
6
shoutOutRandomMe
ssage() Method
Meets “Proficient” criteria and
uses a different random
number for the index for each
20. data structure
Method correctly uses a
random number generator that
selects one word from each
data structure to form a
random message
Method incorrectly uses a
random number generator so
that it does not select one word
from each data structure to
form a random message
Method does not use a random
number generator
6
shoutOutRandomMe
ssage() Return
Meets “Proficient” criteria
substantiated with the correct
format used to return the
message string
Method returns a randomly
generated message in
accordance with the given
specifications and in the proper
string format
21. Method returns a randomly
generated message, but not in
accordance with specifications
or not in the proper string
format
Method does not return a
randomly generated message
6
MyClone Method
introduction()
Meets “Proficient” criteria
substantiated with formatted
printing used to display the
introduction; message displayed
is aesthetically pleasing;
introduction() method uses
getters or accessor methods to
get the current value of the first
name and last name instance
variables
Method correctly displays a
greeting, the full name of the
clone, and an introduction
statement for the virtual world
Method displays a greeting, the
full name of the clone, and an
introduction statement for the
virtual world, but not correctly
22. Method does not display a
greeting, the full name of the
clone, and an introduction
statement for the virtual world
6
MyClone Class
Instance variables
Meets “Proficient” criteria and
the class includes additional,
creative or real-world private
instance variables that follow
specifications
MyClone class includes required
instance variables that are
made private and have
associated getters and setters
MyClone class includes required
instance variables that are
made private but do not have
associated getters and setters
MyClone class does not include
the required instance variables
and the instance variables are
not made private
23. 7
Additional Class Meets “Proficient” criteria and
the class objects are creative or
unique with private instance
variables that fit the object
The choice class has 2 private
instance variables with
associated getters and setters
and 1 successful method
The choice class has 2 private
instance variables with
associated getters and setters
and 1 method, but the method
is not successful or the instance
variables do not follow
specifications
The choice class does not have
2 private instance variables and
1 method
7
Unit Test: MyClone Meets “Proficient” criteria
substantiated with a user
interface that lets the user
interact with the application;
24. unit test application creates
more than one MyClone object
and tests all possible code paths
Unit test successfully tests all
getters and setters and
method(s) of the class
Unit test tests all getters and
setters and method(s) of the
class, but not successfully
Unit test does not test all
getters and setters and
method(s) of the class
6
Unit Test: ShoutBox Meets “Proficient” criteria
substantiated with a user
interface that allows the user to
interact with the application;
unit test application tests all
possible code paths
Unit test successfully tests all
methods of the class
Unit test tests all methods of
the class, but not successfully
25. Unit test does not test all
methods of the class
6
Unit Test: Additional
Class
Meets “Proficient” criteria
substantiated with user
interface that allows the user to
interact with the application;
unit test application creates
more than one of these objects
and tests all methods more
than once; unit test application
tests all possible code paths
Unit test successfully tests all
getters and setters and
method(s) of the class
Unit test tests all getters and
setters and method(s) of the
class, but not successfully
Unit test does not test all
getters and setters and
method(s) of the class
6
26. Code Documentation Meets “Proficient” criteria and
all methods have a header that
explains the purpose of the
method, the pre-conditions,
and the post-conditions
Code is accurately documented
to explain the purpose and
behavior of the code
Code is documented to explain
the purpose and behavior of
the code, but not always
accurately
Code is not documented to
explain the purpose and
behavior of the code
6
Articulation of
Comments
Meets “Proficient” criteria and
submission is properly cited,
free of errors related to
citations, grammar, spelling,
syntax, and organization and is
presented in a professional and
27. easy to read format
Articulation of comments is
clear and concise, using
appropriate jargon for all users
and viewers, with no major
errors related to citations,
grammar, spelling, syntax, or
organization
Articulation of comments is
clear and concise , but does not
use appropriate jargon for all
users and viewers or has major
errors related to citations,
grammar, spelling, syntax, or
organization that negatively
impact readability and
articulation of main ideas
Articulation of comments is not
clear and concise
8
Earned Total 100%
28. virtual_world final
Virtual World/.classpath
Virtual World/.project
Virtual World
org.eclipse.jdt.core.javabuilder
org.eclipse.jdt.core.javanature
Virtual World/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enable
d
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
30. Virtual World/bin/VirtualWorldPack/MyComputer.classpackage
VirtualWorldPack;
publicsynchronizedclass MyComputer {
private String Mark;
private String OpSystem;
public void MyComputer();
public void MyComputer(String, String);
public void introduce();
public void setMark(String);
public void setOpSystem(String);
public String getMark();
public String getOpSystem();
}
Virtual World/bin/VirtualWorldPack/ShoutBox.classpackage
VirtualWorldPack;
publicsynchronizedclass ShoutBox {
java.util.ArrayList list;
public void ShoutBox();
public void shoutOutCannedMessage();
public void shoutOutRandomMessage();
}
Virtual World/src/VirtualWorldPack/Main.javaVirtual
World/src/VirtualWorldPack/Main.javapackageVirtualWorldPac
k;
publicclassMain{
publicstaticvoid main(String[] argv){
//Creat a new object from MyClone class
31. MyClone human =newMyClone();
//Creat a new object from MyComputer class
MyComputer laptop =newMyComputer();
//Creat a new object from ShoutBox class
ShoutBox genmess =newShoutBox();
//call the setter method to store the first name
human.setFirstName("Jack");
//call the setter method to store the last name
human.setLastName("Decaprio");
//call the method introduction() to display the name and greetin
g
human.introduction();
//call the setter method to store the mark
laptop.setMark("Lenovo");
//call the setter method to store the operating system
laptop.setOpSystem("Windows 8");
//call the introduce method to print the mark and system
laptop.introduce();
//calling the method to display the canned message
genmess.shoutOutCannedMessage();
//calling the method to display the random message
genmess.shoutOutRandomMessage();
}
33. * you to the virtual world
* by displaying a greeting,
* your full
name, and anything else
you would want to say.
* */
publicvoid introduction(){
System.out.println("***************************Welcome T
o My Virtual World Java Application**********************
****");
System.out.println("My first name : "+getFirstName());
System.out.println("My last name : "+getLastName());
}
//method to set the first name of the object
publicvoid setFirstName(String firstname){
this.firstName = firstname;
}
//method to set the last name of the object
publicvoid setLastName(String lastname){
this.lastName = lastname ;
}
//method to get the first nameof the object
publicString getFirstName(){
returnthis.firstName;
}
//method to get the last name of the object
publicString getLastName(){
returnthis.lastName;
}
35. }
/*The introduce() method
* to print the mark and
* the oprating system
* of my laptop
* */
publicvoid introduce(){
System.out.println("My computer mark : "+ getMark());
System.out.println("My computer operating system : "+ getOpS
ystem());
}
//setter method to store the mark on the variable
publicvoid setMark(String mark){
this.Mark= mark;
}
//setter method to store the operating system on the variable
publicvoid setOpSystem(String system){
this.OpSystem= system;
}
//getter method to output the mark on the window
publicString getMark(){
returnthis.Mark;
}
//getter method to output the operating system on the window
publicString getOpSystem(){
returnthis.OpSystem;
}
}
36. Virtual World/src/VirtualWorldPack/ShoutBox.javaVirtual
World/src/VirtualWorldPack/ShoutBox.javapackageVirtualWorl
dPack;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Random;
publicclassShoutBox{
ArrayList<String> list =newArrayList<>();
/*this method display all
* canned messages and
* allow the user
* to select one
*/
publicvoid shoutOutCannedMessage(){
System.out.println(" ");
System.out.println("***************List of canned message**
*************");
list.add(0,"1-Hello World.");
list.add(1,"2-I am studying.");
list.add(2,"3-I am at work.");
list.add(3,"4-I am fine.");
list.add(4,"5-I love java.");
list.add(5,"6-I am on my bed.");
list.add(6,"7-I am eating.");
list.add(7,"8-I use my laptop.");
list.add(8,"9-I am in the kitchen.");
list.add(9,"10-I am reading.");
int size = list.size();
for(int i=0;i<size;i++)
{
System.out.println(list.get(i));
37. System.out.println("---------------------------");
}
int selectedMess;
Scanner scanner =newScanner(System.in);
System.out.print("==> Please select one canned message by ent
er the index number : ");
System.out.print(" ");
selectedMess = scanner.nextInt();
System.out.println(list.get(selectedMess-1));
}
/*The shoutOutRandomMessage() method will
* use a random number generator that selects
* one word from each data structure to form a
random message. Random messages will be in the
following form: Subject - Verb - Adjective - Object –
Adverb
*/
publicvoid shoutOutRandomMessage(){
String[] subject={" He's"," I'm"," She"};
String[] verb={" eating"," catching"," studying"," caughing"};
String[] adjective={" funny"," hard"," good"," polite"};
String[] object={" course"," homework"," books"," dog"};
String[] adverb={" quickly. "," everywhere. "," accordingly. ","
awfully. "};
Random r =newRandom();//intialize a Random
int selectedElement = r.nextInt(subject.length);
for(int i=1; i<=1; i++)