CS21 Spring 2005
Homework 8
Due Monday, April 3 before 11:30pm

You may work with one partner on this assignment. If you do so, please only one of you and your partner submit your joint assignment.
For this assigment, you will complete this week's and last week's in-class assignments (week9 and week10).

Create a hw08 subdirectory and start by copying over my starting point code from ~newhall/public/cs21/hw08/. You can then replace any of these files in that you just copied into your hw08 directory, with corresponding files that you have in your week9 and week10 subdirectories:

cd cs21
mkdir hw08
cd hw08
cp ~newhall/public/hw08/* .

# then you can replace these files with versions from your 
# in-class work (if you'd like):

cp ../week9/CourseGradeBook.java .
cp ../week10/TenureTrack.java .
  1. Complete the TODO parts of CourseGradeBook.java and GradeInfo.java. Remember that you have already completed very similar code for your homework 6 assignment, so look at that solution and use it as a starting point for completing the TODO parts here. Sample output from my program is listed at the bottom of this page.

  2. Complete the TODO parts of RunStudentFaculty.java file that create arrays of Person objects and TenureTrack objects, print them out using your generic print method, sort them using your generic sort method, and print them out again (see my sample output in the Sample Output section below).

Handin

For this assigment, I want you to create a tar file of a directory containing your solution code (.java and Makefile, but NOT .class files). You will then submit your tar file using cs21handin.

To do this:

(1) create a submit subdirectory of your hw08 subdirectory:
      % mkdir submit

(2) copy all .java files and the Makefile into this directory:
      % cp *.java submit/.
      % cp Makefile submit/.

(3) cd into your submit directory, try compiling and running just
    to test that you have everything in here that you want
    then run make clean to remove .class files
      % cd submit
      % make
      % java RunStudentFaculty
      % make clean		# remove .class files
      % cd			# go back to your hw08 subdirectory

(4) from your hw08 directory create a tar file, which is a single
    file that contains multiple files and/or directories and their
    contents
    # tar cvf <tarfilename>  <list of files and directories to tar>
      % tar cvf hw08.tar submit	

    # to list a tar file's contents:
      % tar tvf hw08.tar

    # if you want to check to see that your tar file contains the correct
    # contents, copy it to a private temporary subdirectory, untar it,
    # and try compiling and running it:
      % mkdir temp
      % cp hw08.tar temp/.
      % cd temp
      % tar xvf hw08.tar   
      % ls 	# will see submit subdirectory you can cd into it and see 
    		# and compile untared files
See the man page for tar, for more information:
% man tar

Sample Output

Here is output from a run of my CourseGradeBook code:
% java CourseGradeBook student.dat

Exam 1:
   75   94   94   63   90   76   93   86   51   97

Exam 2:
   96  100  100   76   53   86   59  100   57   79

Exam 3:
   61   83   60   81   55   87   84   93   55   73


Student:           exam scores
--------           -----------
Jo Schmoe          75   96   61
Bo Schmoe          94  100   83
Mo Schmoe          94  100   60
Flo Schmoe         63   76   81
Zoe Schmoe         90   53   55
Jerri Schmoe       76   86   87
Larry Schmoe       93   59   84
Barry Schmoe       86  100   93
Mary Schmoe        51   57   55
Peri Schmoe        97   79   73


Exam  	 min 	 max 	ave 	std dev     max student
----  	 --- 	 --- 	--- 	-------     -----------
Exam 1     51	  97	81.90	14.56	    Peri Schmoe
Exam 2     53	 100	80.60	17.90	    Bo Schmoe  Mo Schmoe  Barry Schmoe
Exam 3     55	  93	73.20	13.57	    Barry Schmoe

Exam 1:
Histogram with bucket size of 10:
  0-  9: 
 10- 19: 
 20- 29: 
 30- 39: 
 40- 49: 
 50- 59: * 
 60- 69: * 
 70- 79: * * 
 80- 89: * 
 90- 99: * * * * * 
100    : 

Exam 2:
Histogram with bucket size of 10:
  0-  9: 
 10- 19: 
 20- 29: 
 30- 39: 
 40- 49: 
 50- 59: * * * 
 60- 69: 
 70- 79: * * 
 80- 89: * 
 90- 99: * 
100    : * * * 

Exam 3:
Histogram with bucket size of 10:
  0-  9: 
 10- 19: 
 20- 29: 
 30- 39: 
 40- 49: 
 50- 59: * * 
 60- 69: * * 
 70- 79: * 
 80- 89: * * * * 
 90- 99: * 
100    : 

Histogram with bucket size of 7:
  0-  6: 
  7- 13: 
 14- 20: 
 21- 27: 
 28- 34: 
 35- 41: 
 42- 48: 
 49- 55: * * 
 56- 62: * * 
 63- 69: 
 70- 76: * 
 77- 83: * * 
 84- 90: * * 
 91- 97: * 
 98-100: 
Here is output from a run of my RunStudent Faculty code (this is the version with the overridden compareTo method in the TenureTrack class that compares TenureTrack objects by rank then name):
% java RunStudentFaculty 

UnSorted Array of People:
=========================
Number of People = 5
----------------

  Jo Schmoe
  age = 23

  Bo Schmoe
  age = 18

  Flo Mcshmoe
  age = 44

  Bo LaNo
  age = 88

  Woe McMoe
  age = 12

Sorted Array of People:
=========================
Number of People = 5
----------------

  Bo LaNo
  age = 88

  Woe McMoe
  age = 12

  Flo Mcshmoe
  age = 44

  Bo Schmoe
  age = 18

  Jo Schmoe
  age = 23

UnSorted Array of TenureTrack:
===============================
Number of People = 20
----------------

  Jo Larson
  age = 37
  department = English
  rank = Full Professor
  does not have tenure

  Jo Hanson
  age = 53
  department = English
  rank = Assistant Professor
  does not have tenure

  Jo Larson
  age = 52
  department = Math
  rank = Full Professor
  does not have tenure

  Karen Larson
  age = 46
  department = CompSci
  rank = Assistant Professor
  does not have tenure

  Jo Hanson
  age = 62
  department = Music
  rank = Full Professor
  has tenure

  Jo Larson
  age = 45
  department = Physics
  rank = Associate Professor
  has tenure

  Karen Johnson
  age = 64
  department = Math
  rank = Full Professor
  does not have tenure

  Thomas Johnson
  age = 46
  department = Engineering
  rank = Associate Professor
  does not have tenure

  Jo Johnson
  age = 48
  department = Engineering
  rank = Full Professor
  has tenure

  Thomas Larson
  age = 46
  department = Engineering
  rank = Assistant Professor
  does not have tenure

  Jo Larson
  age = 45
  department = CompSci
  rank = Associate Professor
  has tenure

  Thomas Larson
  age = 41
  department = Physics
  rank = Full Professor
  does not have tenure

  Thomas Larson
  age = 34
  department = Engineering
  rank = Full Professor
  has tenure

  Jo Johnson
  age = 42
  department = Engineering
  rank = Associate Professor
  does not have tenure

  Karen Nelson
  age = 56
  department = Music
  rank = Associate Professor
  does not have tenure

  Thomas Larson
  age = 56
  department = CompSci
  rank = Full Professor
  has tenure

  Karen Larson
  age = 35
  department = English
  rank = Full Professor
  has tenure

  Thomas Larson
  age = 40
  department = Math
  rank = Full Professor
  has tenure

  Jo Hanson
  age = 51
  department = Physics
  rank = Full Professor
  has tenure

  Jo Larson
  age = 42
  department = Music
  rank = Full Professor
  does not have tenure

Sorted Array of TenureTrack:
===============================
Number of People = 20
----------------

  Jo Hanson
  age = 53
  department = English
  rank = Assistant Professor
  does not have tenure

  Karen Larson
  age = 46
  department = CompSci
  rank = Assistant Professor
  does not have tenure

  Thomas Larson
  age = 46
  department = Engineering
  rank = Assistant Professor
  does not have tenure

  Jo Johnson
  age = 42
  department = Engineering
  rank = Associate Professor
  does not have tenure

  Thomas Johnson
  age = 46
  department = Engineering
  rank = Associate Professor
  does not have tenure

  Jo Larson
  age = 45
  department = Physics
  rank = Associate Professor
  has tenure

  Jo Larson
  age = 45
  department = CompSci
  rank = Associate Professor
  has tenure

  Karen Nelson
  age = 56
  department = Music
  rank = Associate Professor
  does not have tenure

  Jo Hanson
  age = 62
  department = Music
  rank = Full Professor
  has tenure

  Jo Hanson
  age = 51
  department = Physics
  rank = Full Professor
  has tenure

  Jo Johnson
  age = 48
  department = Engineering
  rank = Full Professor
  has tenure

  Karen Johnson
  age = 64
  department = Math
  rank = Full Professor
  does not have tenure

  Jo Larson
  age = 37
  department = English
  rank = Full Professor
  does not have tenure

  Jo Larson
  age = 52
  department = Math
  rank = Full Professor
  does not have tenure

  Jo Larson
  age = 42
  department = Music
  rank = Full Professor
  does not have tenure

  Karen Larson
  age = 35
  department = English
  rank = Full Professor
  has tenure

  Thomas Larson
  age = 41
  department = Physics
  rank = Full Professor
  does not have tenure

  Thomas Larson
  age = 34
  department = Engineering
  rank = Full Professor
  has tenure

  Thomas Larson
  age = 56
  department = CompSci
  rank = Full Professor
  has tenure

  Thomas Larson
  age = 40
  department = Math
  rank = Full Professor
  has tenure