package orgChart;

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

public class Employee
{

    /**
     * class and instance variables
     */

    private static String companyName  = "XYZ inc.";     // class variables
    private static int    employeeCount;
    
    private String position;                             // instance variables
    private String lastname;
    private String firstname;
    private String sex;
    private int    age;

    /**
     * Constructors for objects of class Employee
     */

    public Employee(String title)                    // first constructor
    {
        position       = title;
        employeeCount += 1;         
    }

    public Employee(String title, String last, String first, String x, int old)   
    {
        this(title);                                 // call first constructor
                                                     // add pass it title
        lastname  = last;
        firstname = first;  
        sex       = x;
        age       = old;
    }

    public Employee(Employee obj)                    // copy constructor    
    {
        this(obj.position, obj.lastname, obj.firstname, obj.sex, obj.age);
    }

    /**
     * class and instance methods
     */

    public void setLastname(String lastname)         
    {
        this.lastname = lastname;
    }

    public String toString ( )                      // toString instance method
    {
        String data = "Position: " + position + 
                      "\t Name: "  + firstname +  " " + lastname + 
                      "\t Sex: "   + sex + "\t Age: " + age;
        return (data);
    }
}