Create a base employee class with instance variables


Problem:

Question 1- Part 1- Create a base Employee class with instance variables and properties: FirstName & LastName. The constructor for Employee should accept values for firstname, lastname and socialSecurityNumber and initial the values. Employee should have a toString method to output the values for each employee.

Part 2- Create a derived class for an employee type Pieceworker. A pieceworker is paid a fee for each piece completed, i.e., # pieces * fee per piece. Class Pieceworker should add private instance variables fee and pieces. Pieceworker should inherit from Employee; adding in an earnings method to calculate earnings. Create a constructor to initialize firstname, lastname, socialSecurityNumber, fee and pieces. Override the toString method to output all variables.

Part 3- Create a third class to create objects of Pieceworker, then calculate earnings; output all values including earnings.


Show the code, demonstrate it works properly and describe what it is doing.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Create a base employee class with instance variables
Reference No:- TGS0893711

Expected delivery within 24 Hours