Project 8
Due Date: beginning of lecture, Thursday, Dec. 4, 2003
You may submit late projects to your lab instructor's mailbox through 5
PM, Dec. 8, with the usual late fee; NO projects will be accepted after
the Dec. 8 deadline.
The goal of this project is to build on Project
7, to build a collection of students that might represent a course.
Part 1:
The file StudentCollection.java contains a Java class that
will
represent a course of students using a partially-filled array of Student objects. Four methods
are provided already:
-
a constructor, which creates an empty collection and sets its current
size
to 0;
-
a getter that returns the current size;
-
a toString method that
creates a giant string containing the whole collection;
-
finally, a method that adds a student to the collection
In this part of the project, you'll add two more methods:
-
a boolean method that accepts as a parameter a student ID, then
attempts
to delete the corresponding student, returning true if the
deletion
succeeds and false if that ID is not present in the course;
-
a method that accepts a student ID, then attempts to find and return
the
corresponding student object. If the ID is not present in the course,
this
method returns null (see p. 270-271 regarding null).
Develop a test plan for the revised collection class (including the addStudent
method), and a test program that carries out your plan. Document your
class
with javadoc.
Part 2:
SimpleUI.java contains a skeleton for a very simple
menu-driven
user interface. In this part of the project, you'll rebuild SimpleUI
to provide these operations on a student collection:
-
add a student to the course
-
delete a student from the course
-
find and display a student whose ID the user enters
-
enter a test score for a given student
-
display all the students in the course
As each operation is carried out, make sure you inform the user whether
or not the operation succeeds.
Extra credit:
No framework bonus for this project. You have 2 calendar weeks to
complete
it; if you manage your time properly, you won't be crashing the
deadline.
MBF 11/17/03