Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!