Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Calculate the total weekly payroll .(Java programming) Employee Base class: Every person has a name, a base salary and number of hours worked in a
Calculate the total weekly payroll.(Java programming)
Employee Base class:
Every person has a name, a base salary and number of hours worked in a week.
Create an Employee Base class. It should have the following:
- A constructor that accepts weekly hours, name and base salary
- An accessor method for name, a base salary and number of hours worked in a week.
- An abstract method for the weekly pay that returns a double.
Child class:
Create a child class for the four employee types.
They should each have the following:
- A method that overrides the weekly pay method with the correct implementation for the amount.
- A method that overrides the toString method the prints the employee name and the weekly pay.
You will need to create the correct employee type for each employee:
- Recall how to parse text
- When you got to create each employee select the correct type.
- If Only we had some named constant to help us out with this.
- (Yes you need to create an Enum for Employee Type)
Main Method:
- Create a Class with a main method that prints the employee name and the weekly pay based on the following data.
- Use an ArrayList of Employees to hold all the different employees.
- Read the data file and create the correct type for each employee.
- Also calculate the total payroll for the week. Use a loop!
-
Employee Type Name Base Salary Hours for the week Cobra Commander Cobra Commander 120 Destro 90 85 Baroness Greg Marcia High Command High Command Crimson Guard Crimson Guard Crimson Guard Crimson Guard Cobra Trooper Cobra Trooper Cobra Trooper Cobra Trooper 1,200,000 900,000 125,000 125,000 120,000 80,000 Peter 67 70 40 45 Jan Larry Curly Moe Marvin the Martian Hawk Cobra Trooper Cobra Trooper Cobra Trooper Cobra Trooper Torpedo Scarlett Scoop 0 25 Type Weekly Payment Method 1 Dollar Cobra Commander (He makes his money by improving the overall value of the company) High Command Base Salary/52 Crimson Guard Base Salary/52 + (# Hours > 40) * 25 Cobra Trooper (# Hours 40) * 25 Employee Type Name Base Salary Hours for the week Cobra Commander Cobra Commander 120 Destro 90 85 Baroness Greg Marcia High Command High Command Crimson Guard Crimson Guard Crimson Guard Crimson Guard Cobra Trooper Cobra Trooper Cobra Trooper Cobra Trooper 1,200,000 900,000 125,000 125,000 120,000 80,000 Peter 67 70 40 45 Jan Larry Curly Moe Marvin the Martian Hawk Cobra Trooper Cobra Trooper Cobra Trooper Cobra Trooper Torpedo Scarlett Scoop 0 25 Type Weekly Payment Method 1 Dollar Cobra Commander (He makes his money by improving the overall value of the company) High Command Base Salary/52 Crimson Guard Base Salary/52 + (# Hours > 40) * 25 Cobra Trooper (# Hours 40) * 25
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