There are two types of employees at Tiny Manufacture LLC: full-time employees and part-time employees. A commission-based employee is a type of part-time employee.
A full-time employee is characterized by their name, hire date, annual salary, and a method for calculating their weekly pay, based on 52 weeks per year.
A part-time employee is characterized by their name, hire date, current week's hours worked, hourly rate, and a method for calculating their weekly pay. The formula for calculating the weekly pay is as follows: weekly pay = current week's hours worked × hourly rate.
In addition to the characteristics of a part-time employee, a commission-based employee also has a weekly sales amount and a commission rate. Their weekly pay is calculated using the following formula: weekly pay = current week's hours worked × hourly rate + weekly sales amount × commission rate.
The weekly pay method in the Employee class needs to be declared as abstract.
To handle the concept of a minimum wage, create an interface called MinimumWage. This interface should have a field for the state minimum hourly wage and a method named metMinimum, which returns true if the wage meets the minimum requirement. The commission-based employee class must implement the MinimumWage interface.
Next, create a class called EmployeeTest with the main() method. This class will be used to test the different employee classes. Create an object for both a full-time employee and a part-time employee. Additionally, create two objects for commission-based employees, one that meets the state minimum wage and another that does not. Use the provided employee data from the sample output below. Finally, display the details of all the employees.
Sample output:
Full-Time Employee:
- Name: John Doe
- Hire Date: 2023-01-15
- Weekly Pay: $1153.85
Part-Time Employee:
- Name: Jane Smith
- Hire Date: 2023-02-05
- Weekly Pay: $300.00
- Hours Worked: 20.0
- Hourly Rate: $15.00
Commission Employee 1:
- Name: Mike Johnson
- Hire Date: 2023-03-10
- Weekly Pay: $250.00
- Hours Worked: 40.0
- Hourly Base Rate: $5.00
- Weekly Sales Amount: $1,000.00
- Commission Rate: 0.05
- Meet state minimum wage: False
Commission Employee 2:
- Name: Sarah Davis
- Hire Date: 2023-04-20
- Weekly Pay: $700.00
- Hours Worked: 40.0
- Hourly Base Rate: $5.00
- Weekly Sales Amount: $100,000.00
- Commission Rate: 0.05
- Meet state minimum wage: True