Project 9
Due Date: beginning of lecture, Thursday, Dec. 8, 2005 (last class day)
NO projects can be accepted after
the Dec. 8 deadline.
The goal of this project is to build on Project
8, 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. You can copy CSci53.java to use as a
starting point for your test program. Document your
class
with javadoc.
Part 2:
CourseUI.java contains a skeleton for a very simple
menu-driven
user interface. In this part of the project, you'll complete CourseUI
to provide these operations on a student collection:
- add a student to the course -- read the student's data
interactively
- delete a student from the course -- prompt the user for the
student's ID
- find and display a student whose ID the user enters
- 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. If you manage your time properly,
you won't be crashing the
deadline.
MBF 11/28/05