Reference no: EM132587206
Question:
However, it's important to note that not all employees are CommissionEmployees.
Create a more general Employee superclass that factors out the attributes and behaviors in CommissionEmployees that are common to all Employees. The common attributes and behaviors for all Employees are firstName, lastName, socialSecurityNumber, getFirstName, getLastName, getSocialSecurityNumber, and a portion of the method toString. Create a new superclass Employee that contains these instance variables and methods and a constructor.
Next, rewrite the CommissionEmployee class as a subclass of Employee. CommissionEmployee should contain only the instance variables and methods that are not declared in superclass Employee. CommissionEmployee's constructor should invoke Employee's constructor and CommissionEmployee's toString method should invoke Employee's toString method.
Create a Driver class to test your new CommissionEmployee class. Prompt the user to input the first name, last name, social security number, gross sales, and commission rate and create a CommissionEmployee object, using the toString method to print its information.