Question
Part 1: You are hired to develop a payroll system for a company. There are three types of employees: Manager, CommissionEmployee, and HourlyWorker. The common
Part 1: You are hired to develop a payroll system for a company. There are three types of employees: Manager, CommissionEmployee, and HourlyWorker. The common attributes and behaviors for all Employees are firstName, lastName, employeeID (3-digit number). Managers get paid a fixed weekly salary, commission employees get paid based on base salary and commission (commission rate x sales), hourly workers get paid an hourly wage wuith time-and-a-half-1.5 times the hourly wage for hours worked over 40 hours. For this assignment, you will create a more general Employee superclass that contains these instance variables and methods and a constructor. Create three other classes(Manager, CommissionEmployee, and HourlyWorker) that all inherit from class Employee. Each subclass should contain only the instance variables and methods that are not declared in superclass Employee as shown below: Manager: weekly salary CommissionEmployee: base weekly salary, commission rate, and weekly sales HourlyWorker: hours worked, wage (that represents the wages per hour) And earnings method for all the three subclasses to calculate weekly earnings. Write a tester program called Payroll.java to test your payroll program as follows: Create an employee for each type of employee, then calculate earnings for each employee. Here is a sample output: Manager: Steve Davis $2000 Commission Employee: John Kanet $1500 (Base salary: $800, sales: $7000, Commission rate: 10%) Hourly Worker: Thomas Hill $1100 (Hourly wage: $20, hours worked: 50) Part 2: The Class Payroll: Create a class called Payroll2.java with a main method to test your classes. This method should create an array of the size of type Employee that is specified in the first line of the data file. Then, populate the array using data from the text file data.txt using appropriate Java I/O techniques. Each line (except the fist line-which is the number of employees in the file) of the file will look similar to one of these: #Steve Davis,2000 //manager @Thomas Hill,20,50 //hourly worker *Lisa Green,800,6000,0.10 //Commission employee Here is a sample input data 4 #Steve Davis,2000 *John Kanet,800,7000,0.10 @Thomas Hill,20,50 *Lisa Green,800,6000,0.10 Based on the first letter in each line (*, @, #) your method will know whether to create a new Manager, HourlyWorker, or CommissionWorker object. Once created, populate the object with the remaining values then store it in the array. Finally, iterate through the array of employees using the enhanced for loop syntax, and print out each employee in the following format: Manager: Steve Davis $2000 Commission Employee: John Kanet $1500 (Base salary: $80, sales: $7000, Commission rate: 10%) Hourly Worker: Thomas Hill $1100 (Hourly wage: $20, hours worked: 50)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started