Assume the employees' names, salary, base salary, commission rate, hourly rate are already entered into the system (from the database, for example). You run this program weekly to enter the data depending on the employee's position:
Salarid employee: No data to be entered.
Commission employee: Enter the amount of gross sales.
Base plus commission employee: Enter the amount of gross sales.
Hourly employee: Enter the hours worked.
You are required to write a GUI program instead of a console program.
For this assignment
you should add an abstract method, e.g. enterData into the superclass Employee, and override it in each of its subclasses. To
test, create an array of Employees. Loop through the array to enter data. Then loop through the array again to calculate and output their earnings. Here are the detailed steps:
1/ Copy Employee.java and its 4 subclasses into a folder Assign9. In Eclipse create a project on this folder.
2/ Create a new class Assign with public static void main(
String[] args)
3/ In Employee.java, add public abstract void enterData();
4/ Implement the method enterData() in the class SalariedEmployee, CommissionEmployee, and HourlyEmployee. You don't have to implement it in BasePlusCommissionEmployee. It should input data by calling JOptionPane.showInputDialog() with the specific prompt, and call the corresponding setGrossSales() or setHours().
5/ In Assign main() method, create an array of Employee. Construct the 4 subclass objects as did in PayrollSystemTest.java except that the sales or hours should be zero. Store them into the array.
6/In a loop through the array, call employee.enterData();
7/ After all data are entered, loop through the array again and output the payroll by calling employee.toString() and employee.earnings()
8/Append the output into a String, and call JOptionPane.showMessageDialog() after the loop.
I'm done with 1,2,3, but the rest i can't figue it out. Can someone help me?