Question: create a superclass, a subclass, and a driver class. Objects will be stored in an ArrayList. A class named Employee should include the following: Employee
create a superclass, a subclass, and a driver class. Objects will be stored in an ArrayList. A class named Employee should include the following: Employee first name, last name, phone number No-arg constructor and at least 1 overloaded constructor Accessor & mutator methods toString method to display the employees full name and phone number A class named ShiftWorker should include the following: Employee pay rate per hour and hours worked. Employee shift number. The workday is divided into two shifts: day & night. Day shift is represented by the number 1 and night shift is represented by the number 2. The night shift workers get paid 1.5 times their rate of pay. Example: if Sam works day shift and earns $20/hour, he would earn $30/hour on night shift. No-arg constructor and at least 1 overloaded constructor Accessor & mutator methods Method to calculate employees total pay for the period (pay rate * shift differential * hours worked) toString method to display the employees full name, phone number, shift number, hourly pay, hours worked, and total pay for the period according to their shift. Format the hourly pay and total pay for currency. Format the hours worked to 2 decimal places. Access the toString from the super class. A class with a main method that runs the program & includes the following: Get user input either in the console or with dialog boxes for employee name, phone number, shift, hourly pay rate, and hours worked this period. Create an instance of a ShiftWorker object & initialize the object with the user input using the class setter methods. Create at least one more instance of a ShiftWorker object & initialize the object(s) for a different employee. This time, initialize the object(s) using the overloaded constructor. To demonstrate polymorphism & dynamic binding, create at least 1 more instance of an object using a supertype as the declared type and ShiftWorker as the actual type. Initialize the object(s) using the overloaded constructor. This driver class should never create an object with Employee as the actual type. Create an ArrayList named employeeList of the objects created in your program. Then display the size of the ArrayList and the elements using an ArrayList method. Reminder: you may need to cast objects.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
