Question: java For this assignment, you will use inheritance. Your project should include four classes as described below. 1. Create a class that contains the main

java

For this assignment, you will use inheritance. Your project should include four classes as described below.

1. Create a class that contains the main method. In the main method perform the following:

(a). Create an instance of the employee class, the salaried class and the contractor class (described below). Call the payCheck method for each one.

(b). Create an array of employee objects. Put all instances of the employee class, salaried class and contractor class into the array.

2. Create a class called employee that includes:

(a). A constructor that accepts parameters

(b). Instance variables to hold the name and SSN of an employee

(c). A payCheck function that displays the employee name and SSN.

3. Create a class called FTE for Full Time Employees that inherits from the employee class and includes:

(a). Instance variable to hold the employee's salary

(b). A constructor that accepts the name, SSN and salary of an employee. This constructor should call the employee class constructor to set the name and SSN. The constructor should also set the salary instance variable.

(c) .Override the payCheck function to display the name, SSN and the salary divided by 12. This will be a monthly paycheck.

4. Write a class called contractor that inherits from the employee class that includes:

(a). Instance variable to hold the contractor's hourly pay rate.

(b). A constructor that accepts the name, SSN, and pay rate. The constructor should call the employee class constructor to set the name and SSN. The constructor should also set the pay rate instance variable.

(c). A payCheck method that accepts the hours worked as a parameter. This method should display the contractor's name, SSN and the total pay, which should be calculated by multiplying the pay rate times the hours worked.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!