/**************************************************************************
 * The Employee class
 * PS. Notice the above class does not have a main() method
 *************************************************************************/
public class Employee 
{
    static String companyName  =  "XYZ inc.";               //static fields
    static int    employeeCount;                            //belong to the class
    
    String position;                                        //instance fields
    String lastname;                                        //belong to each object
    String firstname;
    String sex;
    int    age;

    Employee(String title , String last, String first, String x, int old)     // constructor
    {
        position  = title;
        lastname  = last;
        firstname = first;
        sex       = x;
        age       = old;
        
        employeeCount += 1; 
    }

    static int getEmployeeCount()                                   //static method
    {                                                               //belongs to the class
        return (employeeCount); 
    }
    static void companyInfo()                               
    {                                                       
        System.out.println("Company   "  + companyName);
        System.out.println("Empl count " + employeeCount);
    }

    String  getFullname (String salutation)                           //instance method
    {                                                                 //belongs to each object
        String fullname = salutation +" "+ firstname +" "+ lastname;    
        return (fullname);
    }
    
    //Every object should ("best practice") have a toString( ) method
    //The toString( ) method should return the content of the object in one long string 
    //If you use the object in any string context (e.g. printing), the toString( ) method will 
    //automatically be called.  We will cover this in more detail later

    public String toString()                                        //instance method
    {                                                               //belongs to each object
        String data = "Company     "  + companyName +               //must be public                
                      "\t Position: " + position  +                 
                      "\t Name: "     + firstname +" "+ lastname + 
                      "\t Sex: "      + sex + 
                      "\t Age: "      + age;
        return (data);
    }
}