Create a sub class named Administrator, which is also a kind of employee in a hospital. Please add the following structures to Administrator class. Field added Identifiers for field | Data type for field or methods or parameters for methods String department Methods Administrator to be handled setDepartment getDepartment toString administrate Parameter.empName, empNumber,dept Jason 404 HR department Vito works for the hospital. Additional requirement The method Administrator is a constructor. Returns a description of this administrator as a string Prints a message appropriate for this administrator Then add statements in the example main driver file(Hospital.java) and exercise the main class. You may remove the statements for the objects of Doctor and Nurse in the main driver class because they were implemented in the examples. The main driving class only creates two objects, one is an Employee(Vito), the second one is an Administrator(Jason). When you run your program, you may see the result like this: > run Hospital Vito 123
Hospital Employee
Hospital Java
//********************************************************************
// Hospital.java Authors: Lewis/Loftus
//
// Solution to Programming Project 9.2
//********************************************************************
public class Hospital
{
//-----------------------------------------------------------------
// Creates several objects from classes derived from
// HospitalEmployee.
//-----------------------------------------------------------------
public static void main(String[] args)
{
HospitalEmployee vito = new HospitalEmployee("Vito", 123);
Doctor michael = new Doctor("Michael", 234, "Heart");
Nurse sonny = new Nurse("Sonny", 789, 6);
// print the employees
System.out.println(vito);
System.out.println(michael);
System.out.println(sonny);
// invoke the specific methods of the objects
vito.work();
michael.diagnose();
sonny.assist();
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images