Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Program Define a class SchoolEmployee with Fields of FirstName, LastName, O

ID: 3822022 • Letter: J

Question

Java Program

Define a class SchoolEmployee with Fields of FirstName, LastName, OfficeNumber, Organization and a set of set/get methods. It also has a method, Work, which just print out a simpSle sentence, “FirstName+LastName works for UHCL”

Define a new class, Faculty, extends SchoolEmployee, by adding a new field OfficeHour, and new related get/set method, override the Work method and make it print out a new sentence, “FirstName+LastName works for UHCL at OfficeHour”.

Define a new class, DepartmentChair, extends Faculty, by adding a new field Department, and new related get/set method, override the Work method and make it print out a new sentence, “FirstName+LastName works for UHCL at OfficeHour. He chairs the department of Department”.

Explanation / Answer

class SchoolEmployee
{
private int OfficeNumber;
private String FirstFirstName,LastName;
string Organization;

public int getOfficeNumber()
{
return OfficeNumber;
}

public void setOfficeNumber(int newOfficeNumber)
{
OfficeNumber = newOfficeNumber;
}

public string getFirstName()
{
return FirstName;
}

public void setFirstName(String newFirstName)
{
FirstName = newFirstName;
}

public string getLastName()
{
return LastName;
}

public void setLastName(String newLastName)
{
LastName = newLastName;
}

public string getOrganisation()
{
return Organisation;
}

public void setOrganisation(String newOrganisation)
{
Organisation = newOrganisation;
}

public void work()
{
System.out.println(FirstName + LastName + "works for UHCL");
}

}

class Faculty extends SchoolEmployee
{
long OfficeHour

public long getOfficeHour()
{
return OfficeHour;
}

public void setOfficeHour(long newOfficeHour)
{
OfficeHour = newOfficeHour;
}

public void work()
{
System.out.println(FirstName+LastName+ " works for UHCL at "+OfficeHour);
}
}

class DepartmentChair extends Faculty
{
private string Department;

public String getDepart()
{
return Department;
}

public void setDepartment(String newDepartment)
{
Department = newDepartment;
}

public void work()
{
System.out.println(Firstname+Lastname+ "works for UHCL at" + OfficeHour + ".He chairs the department of "+Department);
}
}

The above are the 3 classes with the setter and getter methods and with the specified fields.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote