Question: In this project, you'll create a hierarchy of Java classes representing various types of employees in at company (executive, manager, worker). Each different employee

In this project, you'll create a hierarchy of Java classes representing various types of employees in at company (executive, manager, worker). Each different employee class will have its own.java source file, and will be derived from the base class Employee. For the root of the Employee class hierarchy, write a class named Employee that will be the base class of all the other Employee types. It should have two private String instance variables representing the employee's name and type, and a private double instance variable representing the employee's hourly payrate. The class should have the following public methods: public Employee (String type, String name) a constructor that sets the type and name instance values. public String getName()-this method returns the object's name value. public String getType()-this method returns the object's type value. public double get Payrate () this method returns the object's hourly payrate. It must be overridden in each class. For the base Employee class, this method retums 0.0. public double payCheck (this method computes and retums the object's weekly payCheck amount by multiplying their hourly rate (different for each type) by 40 hours. It must be overridden in each derived class. For the base Employee class, this method returns 0.6. public String toString(this method returns the object's description (name, type, payrate, and paycheck) as a String it must be overridden in each derived class. For the hase Empl nyer class this method returns the string "generic employee". Write a Executive class that extends Employee. It should have one private double instance variable representing the executive payrate of $50.00 per hour, and should have the following public methods: public Executive (String type, String name) - a constructor that invokes the base constructor (passing the type and name), then sets the payRate instance variable. public double get Payrate () this method returns the object's hourly payrate. public double payCheck (this overriding method computes and returns the Executive object's hourly payrate. public String toString( this overriding method retums the Executive object's description ((name, type, payrate, and paycheck). Write a Manager class that extends Employee. It should have one private double instance variabe representing the manager payrate of $35.00 per hour. It should also have a constructor and overriding methods for getPayrate), payCheck ( ), and toString(). Write a Worker class that extends Employee. It should have one private double instance variable representing the worker payrate of $20.00 per hour. It should also have a constructor and overriding methods for getPayrate), payCheck ( ), and toString(). Each derived class constructor must call the base Employee constructor with the name and type parameters. Derived classes co not provide a method override for getName() or getType( base Employee class implementation is inherited. ). The The Employee Demo class (download provided below) is the driving program that will create the array and print the corresponding entered data. The order that you compile your Java source files is important. You must have your Employee.java file written and compiled before you can compile any of the derived classes (e.g. Manager.java) that extend from the class Employee. All the Employee derived classes must be compiled before you can compile your Employee Demo source file containing main() and getEmployee ( ). The requirement is that if you use a class name in you code, the Java compiler must be able to find the compiled.class file for that class while compiling the code. Sample Output The output of the EmployeeDemo program should look similar to the following (output is handled by the EmployeeDemo program, you do not need to do anything to it): Enter a list of Employees 'done' to end Enter the employee's type (or 'done)... executive Enter the employee's name.... B111 Enter the employee's type (or 'done)... worker Enter the employee's name.... Bally Enter the employee's type (or 'done).... manager Enter the employee's name... Eunice Enter the employee's type (or 'dona)... dona The list of employees entered... Bill, executive, su.uu/nour, $2,000.00 weOKLY Sally, worker, $20.00/hour, $800.00 weekly Eunice, manager, $35.00/hour, $$1,400 weekly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
