Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem solving in Java : We wish to manage the overtime allowances for doctors and nurses during the vaccination campaign that was organized to counter

Problem solving in Java :

We wish to manage the overtime allowances for doctors and nurses during the vaccination campaign that was organized to counter the spread of the 'Covid-19' epidemic. We consider the following classes: Staff, Nurse and Doctor. Your job is to define these classes as described below:

Class Staff

Attributes (public) - nationalID (String) - firstName (String) - lastName (String) - overHours (private attribute of type integer, initialized to -1)

Methods:

- The constructor with parameters (nationalID, firstName, lastName) - The getter and setter of the overHours attribute - The abstract method allowance() returning a double - The method toString() returning a string consisting of nationalID, lastName (in uppercase letters) and firstName (capitalized) Class Nurse which inherits from the Staff class and has the following structure:

Attributes (public): - diploma (String) - seniority (integer)

Methods:

- The appropriate constructor - updateOverHours() that asks the user (nurse) to input the number of hours she worked during the last month. - The allowance() method returning : o overHours*45 if the seniority is less than 10 o overHours*75, otherwise - The method toString() returning a string consisting of all the information of a nurse separated by line breaks including ID, First name, Last name, Diploma, Seniority and allowances.

Class Doctor which inherits from the Staff class and has the following structure:

Attributes (public): - speciality (String) - title (String) - The constant HOURLYRATE which is 220

Methods:

- The appropriate constructor - The allowance() method returning: o (overHours + 20) * HOURLYRATE if title is Intern

o (overHours + 10) * HOURLYRATE if title is Resident

o (overHours + 5) * HOURLYRATE if title is Attending

o (0)zero, otherwise - The method toString() returning a string consisting of all the information of a doctor separated by line breaks including ID, First name, Last name, Speciality, Title and allowance.

Class Test: Define the Main method and instantiate the classes.

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions