Project 7
Due Date: beginning of lecture, Thursday, November 18, 2004
The goal of this project is to continue with
development
of your own classes. There will be one more project, which will be due
on December 7, the last day of class. Remember that the scores on
Projects 7 and 8 will not be
dropped, as these two projects are too important.
Project:
In this project you will develop a Java class of your own, and modify
and
test one from the program library. The results of this project will
be used in the next (and final) project of the course..
Part 1:
If you did not complete developing and testing RobustInput in lab, do so now.
Part 2:
Section 4.5 of the textbook discusses a Java class called Student
which uses another class Address. (The source files are, of
course,
in programs53.) In this part of the project, you are going to
modify the Student class as follows.
- Each student object should also contain the student's unique
student
ID,
in the range 111111 to 999999.
- Each student object should also contain the scores for three
tests,
represented
as float values in the range 0.0-100.0.
- Modify the student constructor so it sets the student ID, name,
and
addresses
from parameter values. The test scores should not be
parameters,
but the constructor should set the three test values to 0.
- Provide an parameterless static
input method readStudent that returns
a student object. It prompts the user for the ID, name, and addresses
of
a student, and calls the constructor to set these values. This method
should
call RobustInput.readInt() to read the student ID.
- Provide a "setter" method called setTestScore that
accepts
two
parameters: the test number (1 through 3) and the score.
- Provide "getter" methods for each of the data fields: getID(), getName(), getHomeAddress(), getSchoolAddress(). Several
examples of how to write these simple "getters" are shown in Chapter 4,
especially the banking example on p. 228-229.
- Also provide a "getter" method called getTestScore(int
whichTest) that
accepts
the test number and returns the appropriate score.
- Provide a method called average that computes and
returns the
average test score for this student.
- Finally, modify the toString method such that the test
scores
and average are included in the string.
A "framework" for this class will consist of the existing two methods,
and stubs for the new ones you are adding.
Develop a test plan for this revised student class, and a test program
that carries out your plan. Document your RobustInput and Student
classes with javadoc.
What to submit
You must follow the process given in Systematic
Software Development and the sample project packet distributed
in class.
Your grade will be calculated on a 20-point basis, as follows:
- 6 points -- analysis and design (including relevant algorithms in
structured
English), including javadoc pages
- 4 points -- test plans for both parts
- 6 points -- correct execution of both parts according to test
plans
- 4 points -- layout and style of program source code
Extra credit:
The 2-point framework bonus deadline is 5 PM, Monday, Nov. 15,
2004. The "framework" must
be a listing (.txt) file, with no compilation errors or
warnings, for the stubbed-out modified Student class; also document
the class with javadoc and then e-mail Prof. Feldman the URL of your
javadoc documentation.
MBF 11/8/04