Design a set of classes that define employees of a hospital

Assignment Help JAVA Programming
Reference no: EM131855849

Lab Assignment

Task 1-Inheritance Design

Design and implement a set of classes that define the employees of a hospital: doctor, nurse, and surgeon.

1. The parent class HopitalEmployee contains two protected instance variables: String name and int number. Set up the constructor. Implement the getter and setter methods for each instance variable. Add the toString method.

2. Add the following method to the parent class:

public void work()
{
System.out.println (name + " works for the hospital.");
}

3. Implement two subclasses: Nurse, and Doctor. Besides the inherited variables, Doctor has a new instance variable for specialty, Nurse has a new variable numOfPatients. Implement constructor and override the toString method for these two classes.

4. Now we need to create another class represent surgeon. Consider where you should put this class in the hierarchy. Besides the inherited variables, this class should have a new instance variable operating, which indicates the surgeon is on operating or not. Complete the constructor and toString method for Surgeon class.

5. Now run the tester program Hospital.java provided. Make sure everything is all right before move on.

The expected output is:
Vito 123
Michael 234 Heart
Vincent 645 Brain Operating: true
Sonny 789 has 6 patients.
Vito works for the hospital.
Michael works for the hospital.
Vincent works for the hospital.
Sonny works for the hospital.

6. Override the work() method in each of the three subclasses. Besides printing out that this person works for the hospital, add some more information of this person. Reference the expected output below:

The expected output is:
Vito 123
Michael 234 Heart
Vincent 645 Brain Operating: true
Sonny 789 has 6 patients.
Vito works for the hospital.
Michael works for the hospital. Michael is a(n) Heart doctor.
Vincent works for the hospital. Vincent is operating now.
Sonny works for the hospital. Sonny is a nurse with 6 patients.

Attachment:- Hospital.rar

Reference no: EM131855849

Questions Cloud

Smart goal to meet the community health needs : What can be a smart goal to meet the community health needs?
What is the relevant difference between pt and ptt : Nursing student question re: lab values. What is the relevant difference between PT and PTT?
What would your recommendation to bank management : What would your recommendation to bank management about the purchase of the york machine?
Reduction in preventable cancer deaths : What are some ideas and strategies that could perhaps lead to a further reduction in preventable cancer deaths?
Design a set of classes that define employees of a hospital : Design and implement a set of classes that define the employees of a hospital: doctor, nurse, and surgeon. Implement two subclasses: Nurse, and Doctor.
Assessment of an adolscent patient : What are some effective ways to incorporate this into your assessment of an adolscent patient?
How elements are approaching the consumer market : Amazon has created three elements with how they are approaching the consumer market: fulfillment centers, Amazon Prime, and AmazonFresh.
Explain the managers role : Explain what impact the technology trend has on other users. Explain benefits of the selected technology that support quality outcomes.
How much will the semi-annual mortgage payment : How much will the semi-annual mortgage payment be if he decides to accept the loan offer?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd