Final Group or Individual Project Last Step for CSC172
Clean
up the code by separating the menu from the arraylist
processing. Add one test class with a method for each team member. Write a UML
class diagram. Spruce up the documentation.
The functionality will stay exactly the same.
To
separate the menu from the arraylist processing:
·
create a new object class to hold your item
list. It should have the instance variable of the arraylist.
It will need the following methods:
o
constructor to create an empty
list.
o
void load(), : to do the file load; throws
the FileNotFoundException back to the caller. You can
make the filename holding the data either an instance variable of the item list
class or a parameter to the read and writing, but it is not required
o
void save() : to do the file writing: throws the FileNotFoundException
back to the caller.
o
ArrayList<youritem> getList() : to
return the arraylist
o
yourItem getItem(int Index) : to return one item at the given index
o
void
setItem(int Index, youritem o) : to change the item at the index to the given
item
o
void addItem(youritem n) : to add the given item to the list.
·
Keep
all input/output, including printing to the screen,
inside your menu class, but move as much other processing as you can into the
item list class.
o
The
sort methods can be moved entirely into the item class.
o
The
search method should let the menu ask the word to search for, and then the rest
of the work can be done in an item class method, returning the found object or
throwing a not found exception that the menu must catch.
o
Optional:
§ The map options can
return a map for the menu to display.
§ The set options can
return a set for the menu to display and count.
·
Your
original management class
o
It
will only hold the menu and short methods that do the intput/output
and ask the item list class to execute methods.
o
Note
that the file display will need to continue to be a method in the menu, as all
screen input/output need to stay inside the menu class.
o
It
should not hold an Arraylist, but instead hold an ItemList.
To add
a test class, right click in bluej to add a tester
class. Choose one method to test. Create some test data and run at least 4
tests on that method. It must be a method with output that can be compared.
To
create the uml diagram:
·
You
can create it on paper
·
It
will look similar to the bluej uml
diagram, but fill in instance variables and class types at the top for
interfaces and important methods.
Spruce
up the documentation:
·
Every
method needs a Javadoc description plus input and output parameters
·
The
Javadoc method description should truly describe your method
·
Place
comments to describe any difficult code. As a guide, if you are slightly
confused when you go back to the code, a comment would be good.
·
Rename
parameters and variables to names that are meaningful
Here is
what you were aiming at:
Create
a file based inventory system. This system will be built as a series of
assignments, with a few enhancements at the end of the semester:
Some
intermediate assignments planned:
The
final project submission needs to include:
o
Testing
§ Tester
class with a few good test methods
o
Strong program documentation
§ internal
·
javadoc
generation
·
functions well described in javadoc
·
clear parameter names
·
meaningful
internal comments that would help another maintain your code.