CSC 217 Lab 03: Design
The design of PackScheduler
for Lab 03’s StudentDirectory
functionality consists of four classes in four packages. There are a couple of modifications from the design in Lab 01.
The figure above is an example of a UML class diagram. Each class is represented by a rectangle; the text in the class describes the class members. Arrows indicate relationships between classes. The software used to generate the diagram in the figure uses the following notation conventions:
- A square (empty or solid) in front of a name means private. Solid squares are operations, empty squares are data.
- A green circle in front of a name means public. Solid circles are operations, empty circles are data.
- Members embellished with S are static.
- Members embellished with SF are static, final. (
Student.MAX_CREDITS
is public, static, and final.) - Methods embellished with C are constructors. (See
StudentDirectory.StudentDirectory()
.) - Solid arrows with simple heads indicate has-a relationships, in which one class has a member whose type is another class or interface. The containing class is at the tail of the arrow and the class that is contained is at the head. The arrow is decorated with the name and access of the member in the containing class (- for private, + for public). The arrow is also decorated with the “multiplicity” of the relationship, where 0..1 means there is 1 instance of the member in the containing class and 0..* means there are many, usually indicating a collection such as an array. (
StudentDirectory
has a private member namedstudentDirectory
that is an array ofStudent
s.)
The details of the classes are mostly described in Lab 01. The modifications to each of the classes for Lab 03 are previewed below.
- edu.ncsu.csc216.pack_scheduler.user.Student
Student
now implements theComparable
interface and therefore defines thecompareTo()
method.
- edu.ncsu.csc216.pack_scheduler.io.StudentRecordIO
StudentRecordIO
now uses theSortedList
class rather thanArrayList
. Both thereadStudentRecords()
andwriteStudentRecords()
method headers are updated.
- edu.ncsu.csc216.pack_scheduler.directory.StudentDirectory
StudentDirectory
’s fieldstudentDirectory
is aSortedList
. No method headers are changed.
- edu.ncsu.csc216.pack_scheduler.ui.StudentDirectoryPanel
- There are no changes to the GUI.