Question: ALL IN JAVA: Define a class named Employee , which will store data about each employee at a company. Inherit from the Person class (Person.java

ALL IN JAVA:

Define a class named Employee, which will store data about each employee at a company. Inherit from the Person class (Person.java file attached to this assignment). An Employee inherits its name and honorific (title prefixing a person's name, such as Mr., Ms., Mrs., Dr., Sir, Lady, or Lord) from the Person class. In addition, an employee has instance variables to store annual salary (double), year hired (int), and identification number (String).

The Employee class should have 3 constructors:

Parameterized constructor (honorific, name, annualSalary, yearHired, id)

Parameterized constructor (name, annualSalary, yearHired, id )

Copy constructor

Give your class a reasonable complement accessor methods and mutator methods (do not create a setId( ) method, since the id must be unique), as well as an equals( ) and toString( ) method. Write a demo (driver) program to fully test your class definitions.

Now, define another class named Doctor which will be derived (inherit from) the Employee class. The Doctor class should contain two additional instance variables: specialty (a String, such as Pediatrician, Obstetrician, General Practitioner, etc) and office fee (double).

The Doctor should have 2 constructors:

Parameterized constructor (name, annualSalary, yearHired, id, specialty, officeFee)

Copy constructor

Give your class a reasonable set of accessors and mutators, as well as an equals( ) and toString( ) method.

Below is an inheritance diagram in UML (Unified Modeling Language) of the three classes:

ALL IN JAVA: Define a class named Employee, which will store data

Person Class Fields honorific name - Methods equals getFullName getHonorific ?getName Person (+ 3 overloads) ?setHonorific setName toString Employee Class person - Fields annualSalary id yearHired - Methods Employee (+ 2 overloads) equals getAnnualSalary ?getid ?getYear:Hired setAnnualsalary ?setYearHired toString Doctor Class Employee - Fields officeFee specialty - Methods Doctor (+ 1 overload) equals getSpecialty setSpecialty ?getOfficeFee ?setOfficeFee toString

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!