/*******************************************************************************
 * EmployeeTest class
 ******************************************************************************/
public class EmployeeTest
{
    public static void main (String[ ] args)
    {        
        Employee e1 = new Employee("Director","Sultan","Sam");    //instantiate an object 
        Employee e2 = new Employee("Consultant","Smith","Joe");     
       
        String name1 = e1.employeeInfo();                           
        System.out.println(name1);

        String name2 = e2.employeeInfo2(); 
        System.out.println(name2);
   }
}




/*******************************************************************************
 * Employee class, with local variables having the same name as fields
 ******************************************************************************/
class Employee
{
    static String companyName  = "XYZ Corporation";    	 	//static field
    
    String position;                             			//instance fields
    String lastname; 
    String firstname;

    Employee(String title, String last, String first)		//constructor 
    {
        position  = title;
        lastname  = last;
        firstname = first;  
    }

    String employeeInfo()                                   
    {
        String info = companyName +" "+ position +" "+ firstname +" "+ lastname + "\n";
        return (info);
    }
    String employeeInfo2()                                  
    {
        String companyName = "ABC Consulting ";    		//create local variables with same name as fields
        String position    = "President";                   

        String info = companyName +" "+ position +" "+ firstname +" "+ lastname 
                    + "\n"
                    + Employee.companyName +" "+ this.position +" "+ firstname +" "+ lastname;
        return (info);
    }
}