package schoolDirectory;

import java.io.PrintWriter;
import schoolDirectory.Entry;

public class Faculty extends Entry {
    // Faculty have four special fields
    private String office;
    private int extension;
    private String dept;
    private int firstYear;

    public Faculty (String first, String last, String addr, String room,
             int ext, String department, int yr) {
        super(first, last, addr);
        office = room;
        extension = ext;
        dept = department;
        firstYear = yr;
    }

    // toString method to yield nicely formatted output string
    public String toString () {
        return super.toString()
            + "   Office:  " + office+ "\tOffice Extenstion:  " + extension
            + "\n   Department:  " + dept
            + "\n   First Year at Grinnell:  " + firstYear + "\n";
    }

    public static void main (String [] argv) {
        // suit of tests for Student
        PrintWriter myOut = new PrintWriter(System.out, true);

        // set up three objects
        Faculty A = new Faculty ("Janet", "Gibson", "gibson@grinnell.edu",
                                 "Science 0420", 3168,
                                 "Psychology", 1989);
        Faculty B = new Faculty ("Henry", "Walker", "walker@cs.grinnell.edu",
                                 "Science 2420", 4208, 
                                 "Mathematics and Computer Science", 1973);
        Faculty C = new Faculty ("John", "Stone", "stone@math.grin.edu",
                                 "Science 2418", 3181,
                                 "Mathematics and Computer Science", 1983);
        Faculty D = new Faculty ("Samuel", "Rebelsky", "rebelsky@cs.grin.edu",
                                 "Science 2427", 4410,
                                 "Mathematics and Computer Science", 1997);

        // print objects
        myOut.println();
        myOut.println ("Person A:" + A);
        myOut.println ("Person B:" + B);
        myOut.println ("Person C:" + C);
        myOut.println ("Person D:" + D);

        // since methods equals and comesBefore are inherited, 
        //     testing may or may not be done 

        // check comparisons
        // myOut.println();
        // myOut.println ("Results of equals");
        // myOut.println ("\tA\tB\tC");
        // myOut.println ("A\t"+A.equals(A)+"\t"+A.equals(B)+"\t"+A.equals(C));
        // myOut.println ("B\t"+B.equals(A)+"\t"+B.equals(B)+"\t"+B.equals(C));
        // myOut.println ("C\t"+C.equals(A)+"\t"+C.equals(B)+"\t"+C.equals(C));
         
        // myOut.println ("Results of comesBefore");
        // myOut.println ("\tA\tB\tC");
        // myOut.println ("A\t" + A.comesBefore(A) + "\t"
        //                + A.comesBefore(B) + "\t" + A.comesBefore(C));
        // myOut.println ("B\t" + B.comesBefore(A) + "\t"
        //                + B.comesBefore(B) + "\t"+B.comesBefore(C));
        // myOut.println ("C\t" + C.comesBefore(A) + "\t"
        //                + C.comesBefore(B) + "\t"+C.comesBefore(C));
    }
}
