home—info—lects—labs—exams—hws
tutor/PIs—Object120 + its docs—java.lang docs—java.util docs
hw05
Modifying objects
Student gpas
For this homework, complete (by yourself) anything you didn't finish for lab07a—Mutation!: modifying an object's fields.
(Start with whatever work you completed with your partner in lab,
but if you weren't finished you must add to it yourself.)
Each function beside the constructor must include test cases,
and also javadoc documentation
(@param and @return tags as appropriate).
The start of your file should include acknowledgements of everybody who
contributed code.
Due in class Oct.19 (Tue);
bring a hardcopy, and submit on WebCT under Assignments > lab07.
In particular, you should have (as already mentioned on the lab page):
- (2pts) a class Student
which keeps track of a name, id, major, hours completed, and gradepoints earned
(but not a field for the gpa).
- (3pt) a constructor which takes in a value for each field,
- (3pts) a function enrollNewStudent (modified so that it returns
a new student with no credit hours completed or grade point earned),
- (7pts) a function setMajor,
- (7pts) a function getGPA,
- (9pts) a function recordGrade.
(
You don't need to worry about +/- grades, and you can use 'E' to represent
a failing grade if you like, although it would be nice to allow 'F'.)
(Your test cases can all be in one function, so that
you can have a few local variables to store some Students,
and re-use them for multiple tests.)
home—info—lects—labs—exams—hws
tutor/PIs—Object120 + its docs—java.lang docs—java.util docs