University of Toronto - Spring 2002
Department of Computer Science

Assignment 5 Decisions

Due: Due: March 1, 2002, 12 noon --- no late assignments will be accepted.

You will complete two programs in this assignment. We have provided skeletons of the StudentRecord and DrugData classes. Complete these two classes. Test them throughly.

Problem 1 Olympics checking

The Olympics are approaching. Drug testing has become an important part of the Olympics. Drug testing consumes a lot of time. Write a method to compare an athlete to the Olympics limits for different banned chemicals. It returns a true value if there is concern and the results deserve follow up, false if there is no concerned.

The chemicals tested are human growth hormone (hGh), erythropoetin (EPO) and the following steroids, furazabol, stanozolol, nandrolone, oxandrolone and methenolone acetate.

The logic in the program uses a base candidate object that stores the Olympic limits. Athletes' data are compared with the base candidate object if any of a athlete's readings exceed the base values it is of concern. In addition, even if all of an athlete's readings are less than the limits in the base candidate if the athlete has data values greater than zero for more than half of the substances the athlete is flagged as of concern.

We have provided a DrugData class skeleton and a sample tester class.

Problem 2 Combining marks

While they are not supposed to students often switch tutorial sections. This can cause marks accounting problems. If the tutorials are taught by different TAs the marks for the same student end up in different marks files. To calculate final marks the multiple student records for the same student must be merged into a single record.

We have provided a skeleton of a StudentRecord class that includes a constructor and a toString method. You must write two additional methods. One method compares two student records and decides whether they infact refer to the same student returning a value of true or false. The other method merges the contents of two records that refer to the same student into a single record and returns that record.

We have decided that two student records refer to the same student: if the student numbers and the surnames are the same, or if one record is missing a student number but the surnames are the same and the marks mesh, ie marks are either the same or they are found in one student record but not the other. (A missing student number or missing mark is represented by a null string, a string of length zero.)

If it is decided that a pair of student records refer to the same student based on the criteria above they can be merged to create a single new student record. The new student record will include a student number, a surname and given name (the given name if it is the same in the pair of records. If the given names are different in the two records combine the given names and store the combined name as the given name. Concatenate the names in alphabetical order separated by one space. The new record will also include the list of marks. If a piece of work has a different mark from one record to the other record the higher of the two marks.

Suggestion: The student record problem includes several operations that are repeated. This situation lends itself to writing and using helper methods that solve these repeated subproblems.

We have provided a StudentRecord class skeleton and a sample tester class.

Submission

Submit your StudentRecord.java and your DrugData.java files.

Marking:

Caution: As with earlier assignments this assignment will be auto marked by a computer program. Follow the directions carefully. Take care that you don't add leading or trailing spaces to string fields. Marks are based on program correctness, style and design.