Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following UML diagram: Staff - name: String - birthYear: int - gender: char (M or F) + Staff (----All Parameters----) + setters/getters +toString():

Given the following UML diagram:

Staff

- name: String

- birthYear: int

- gender: char (M or F)

+ Staff (----All Parameters----) + setters/getters

+toString(): String

Doctor

- specialty: String (Pediatrician, Oncologist, etc.)

+ Doctor (----All Parameters----) + setter/getter

+ toString(): String

Clinic

- name: String

- staff : ArrayList

+ Clinic (name: String)

+ getName(): String

+ addDoctor(d: Doctor): void

+ addNurse(n: Nurse): void

+ getStaff(): ArrayList

+ countDoctors(): int

+ countNurseOfType(t:string): int

+ searchDoctorByName( name: String): Doctor + toString(): String

Nurse

- type: String (OR, RN, NP)

+ Nurse (----All Parameters----) + setter/getter

+ toString(): String

Part 1: Implement the following classes (Staff (10 Pts), Doctor (10 Pts), Nurse (10 Pts) and Clinic (35 Pts)). A class Staff is described by the instance variables: name, year of birth and gender. The method toString () return a string containing all the information of the Staff.

The class Doctor derived from the class Staff, which has an additional instance variable designating the specialty. The method toString() returns in addition to the Staff information, the specialty of Doctor. The class Nurse, derived from the class Staff, which has an additional instance variable designating the type of nurse (OR, RN, NP). The method toString() returns in addition to the Staff information, the specialty.

The class Clinic is to manage the list of Staff into the Clinic. The class Clinic is described by a name and an array list of staffs.

Note:

o The method countNurseOfType returns the number of Nurses work into the Clinic of a specific type. o The method searchDoctorByName searches a doctor by its name.

Part 2: Implement a driver class (main class) as follows: (35 Pts)

1. Create a Clinic object with name read from the user.

2. Add to the Clinic object some doctors and nurses as many as the user wants

3. Display the number of doctors in the Clinic object using the corresponding method in the Clinic class.

4. Count the RN nurses using the corresponding method in the Clinic class.

5. Test the searchDoctorByName method by reading the name of doctor from the user and display it if exists.

6. Display all female nurses of type NP.

7. Display the names of all nurses only.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago