package orgChart;

/**
 * Hierarchy class in a package called pkg1
 */

public class Hierarchy
{
    /**
     * class and instance variables
     */
    private static String companyName  = "XYZ inc.";     // class variable
    
    private String   date;                  // instance variable primitive
    private Employee boss;                  // instance variable object
    private Employee sub;

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

    /**
     * Constructor.  Make a copy of the passed objects
     */
    public 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
    }

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