Next: About this document ...
Up: Assignment 9
Previous: Make it a generic
- 1.
- Create a new class named Student, based on HeapItem. It should
have instance variables to contain the name and test score for each
student, and it should implement the Comparable abstract class.
- 2.
- Create a new class named Sorter that will contain main.
Sorter will read a file, create Student objects, put the Student
objects in a Heap, and then remove and print them (in sorted order).
You might want to use Balance.java (in the Balance directory under
coded solutions on the web page) as a template for Sorter, since it
contains the basic loop for reading lines from a file.
- 3.
- Test your program with a range of inputs including some cases
with errors, and any other things that are likely to cause problems
(names with more than two words, or with punctuation, or students
with very large, negative, non-existent, or identical test scores).
Allen B. Downey
1998-11-30