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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Hospital Employee

//********************************************************************
//  HospitalEmployee.java       Authors: Lewis/Loftus
//
//  Solution to Programming Project 9.2 
//********************************************************************
 
public class HospitalEmployee
{
   protected String name;
   protected int number;
 
   //-----------------------------------------------------------------
   //  Sets up this hospital employee with the specified information.
   //-----------------------------------------------------------------
   public HospitalEmployee(String empName, int empNumber)
   {
      name = empName;
      number = empNumber;
   }
 
   //-----------------------------------------------------------------
   //  Sets the name for this employee.
   //-----------------------------------------------------------------
   public void setName(String empName)
   {
      name = empName;
   }
 
   //-----------------------------------------------------------------
   //  Sets the employee number for this employee.
   //-----------------------------------------------------------------
   public void setNumber(int empNumber)
   {
      number = empNumber;
   }
 
   //-----------------------------------------------------------------
   //  Returns this employee's name.
   //-----------------------------------------------------------------
   public String getName()
   {
      return name;
   }
 
   //-----------------------------------------------------------------
   //  Returns this employee's number.
   //-----------------------------------------------------------------
   public int getNumber()
   {
      return number;
   }
 
   //-----------------------------------------------------------------
   //  Returns a description of this employee as a string.
   //-----------------------------------------------------------------
   public String toString()
   {
      return name + "\t" + number;
   }
 
   //-----------------------------------------------------------------
   //  Prints a message appropriate for this employee.
   //-----------------------------------------------------------------
   public void work()
   {
      System.out.println(name + " works for the hospital.");
   }
}

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();
      
   }
}

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
Transcribed Image Text: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
Jason is a HR department Administrator.
Please use "extends, super, and protected" in the appropriate places to show inheritance. You
need three files to work on the project, Hospital Employee.java(no need to change from the
example), Administrator.java(create this new file), and Hospital.java(add some statements to it).
Note: please use inheritance, meaning Administrator class inherits HospitalEmployee. You will
not get credit if you do not use inheritance in the spots where inheritance should be used in the
class Administrator. Doctor and Nurse are good template for Administrator.
Transcribed Image Text:Jason is a HR department Administrator. Please use "extends, super, and protected" in the appropriate places to show inheritance. You need three files to work on the project, Hospital Employee.java(no need to change from the example), Administrator.java(create this new file), and Hospital.java(add some statements to it). Note: please use inheritance, meaning Administrator class inherits HospitalEmployee. You will not get credit if you do not use inheritance in the spots where inheritance should be used in the class Administrator. Doctor and Nurse are good template for Administrator.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY