Question: In JAVA need to design a parent class named Employee. Your Employee class should include: A String, name , that holds the employee's name. an

In JAVA need to design a parent class named Employee. Your Employee class should include:

  1. A String, name, that holds the employee's name.
  2. an integer serialNumber, that holds the employee's serial number.
  3. A no-arg constructor that initializes name to "none" and serialNumber to 0.
  4. A parameterized constructor that initializes name and serialNumber using arguments passed to the constructor.
  5. Getters for name and serialNumber.
  6. A method named getGrossPay( ) that returns a zero;
  7. A method named getFedWithholding( ) that returns a zero.
  8. A method named getStateWithholding( ) that returns a zero.

Design a class named Hourly that inherits from Employee. Your Hourly class should include:

  1. A double, hourlyWage, that holds this person's hourly wage.
  2. A double, hoursWorked, that holds the number of hours this person worked.
  3. An appropriate no-arg constructor.
  4. An appropriate parameterized constructor.
  5. Getters for hourlyWage and hoursWorked.
  6. Overload the getGrossPay( ), getFedWithholding( ) and getStateWithholding( ) methods from the Employee class. The gross pay for an Hourly employee is calculated as hoursWorked x hourlyWage. Use a state tax rate of 0.07 and a federal tax rate of 0.15.

Design a class named Salaried that inherits from Employee. Your Salaried class should include:

  1. A double, annualSalary, that holds the annual salary for this person.
  2. An appropriate no-arg constructor.
  3. An appropriate parameterized constructor.
  4. A Getter for salary.
  5. Overload the getGrossPay( ), getFedWithholding( ) and getStateWithholding( ) methods from the Employee class. The gross pay for an Hourly employee is calculated as annualWage / 52. Use a state tax rate of 0.07 and a federal tax rate of 0.15.

Create a UML diagram that documents your class design. Show the Employee, Hourly and Salaried classes in your diagram. Include your diagram when you submit your assignment. The preferred format is a .PDF file.

Create a new project and add the code for your Employee class, your Hourly class, and your Salaried class. Then create a driver class that contains your main( ) method. Your main( ) method should do the following:

  1. Tells the user what the program does.
  2. Creates an ArrayList.
  3. Create instances for the following employees and add them to the ArrayList: * Hourly employee Harry Hacker, serial number 123. Harry earns $15.00 and hour and works 30 hours a week. * Hourly employee Isabel Intern, serial number 233. Isabel earns $12.50 and hour and works 20 hours a week. * Salaried employee Cathy Coder, serial number 611. Cathy earns $80,000 a year.
  4. Using an appropriate loop to go through the Employees in the ArrayList, print out a payroll report:
  5. Display a goodbye message.

EXAMPLE OF EXPECTED RESULTS

Payroll Report Employee:

Harry Hacker Serial: 123

Gross Pay: $450.00

Federal Withholding: $67.50

State Withholding: $31.50

Net Pay: $351.00

Employee: Isabell Intern Serial: 233

Gross Pay: $250.00

Federal Withholding: $37.50

State Withholding: $17.50

Net Pay: $195.00

Employee: Catherine Coder Serial: 611

Gross Pay: $1,538.46

Federal Withholding: $230.77

State Withholding: $107.69

Net Pay: $1,200.00

Then create a UML diagram that documents your Employee, Hourly and Salaried classes.

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!