/*****************************************************************************
 * Hierarchy class
 * A class that take 2 Employee objects and creates a supervisor/subordinate
 * relationship with them
 ****************************************************************************/
public class Hierarchy
{
    //Notice that some of the fields are not primitive by are object types.

    private static String companyName  = "XYZ inc.";    //class field
    
    private String   date;                              //instance field primitive type
    private Employee boss;                              //instance field object type
    private Employee sub;

    /**
     * Constructor 1.  Reference the passed objects
     */

    Hierarchy(Employee boss, Employee sub, String date)
    {
            this.date  = date;
            this.boss  = boss;               //reference the passed object
            this.sub   = sub;               
    }

    /**
     * Constructor 2.  Make a copy of the passed objects
     */

    Hierarchy(Employee boss, Employee sub, String date, String type)
    {
            this.date  = date;
            this.boss  = new Employee(boss);    //create a new object, and
            this.sub   = new Employee(sub);     //assign it value of passed obj
    }


    public String toString()                        
    {
        String data = "Effective date:  "   + date +
                      "\n  Supervisor  -  " + boss +    
                      "\n  Subordinate -  " + sub;  
        return (data);
    }
}