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:
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 toStringStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started