Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a Java application to calculate the monthly paychecks for a number of different types of employees. The employee types are created in a subclass

Develop a Java application to calculate the monthly paychecks for a number of different types of employees. The employee types are created in a subclass array based on parent base class Employee. Initial code is provided for each class and for a driver class.

You will need to compile each Java source file (provided below) separately, in its own file since they are public classes, to create a .class file for each, ideally keeping them all in the same directory.

You should compile Date.java first, then Employee.java, then CommissionEmployee.java, then BasePlusCommission.java, then HourlyEmployee.java, then SalariedEmployee.java, and finally PayrollSystemTest.java. And maintain this compilation order when you make your customized modifications to these classes later.

As part of the modifications you need to make to the supplied code, you are to prompt the user for all the data that is now provided in the code for the class PayrollSystemTest (i.e. instead of using these values from their declaration in the code, get data from prompting the user for it, one value at a time). All program output, including prompts and results and all program input must be done from the PayrollSystemTest class.

In addition you need to add a new private instance field "birthDate" to the Employee class. The birthDate field must be a Date data type, not a String! Add get and set methods to Employee class for this new birthDate field.

The birthDate field must be determined from separate integer values, supplied by the user, for the birth month, day, and year. As with all other inputs, these three birth date components must be prompted from and input to class PayrollSystemTest. Once input, these three parameter values must then be supplied to the appropriate modified employee subclass constructor, and then the subclass constructors supply these three values to their parent class, a modified Employee class constructor.

The single birthDate field of a Date data type must be declared and initialized in the Employee class.

In class PayrollSystemTest create an array of Employee variables to store references to the various employee objects. In a loop, calculate the monthly paycheck amount for each Employee (polymorphically), and add a $100.00 bonus to the person's monthly payroll amount if the current month (i.e. November) is the month in which the Employee's birthday occurs.

Your program should input data and create the five employees below on the version of the program you submit for grading. Your program must calculate their monthly salaries for November (assumed to be the "current" month). Assume that the monthly salary is simply four times the weekly salary.

  1. one Salaried Employee with a weekly salary of $1000 and a birthday of January 1, 1960,
  2. one Salaried Employee with a weekly salary of $1000 and a birthday in this month (November 1, 1961)
  3. one Commission Employee Worker with a gross weekly sales of $12,000 and a 5% commission rate and a birthday of February 1, 1962,
  4. one Base Plus Commission Employee with a gross weekly sales of $10,000, a 3% commission, and a $500 base weekly salary with a birthday of March 1, 1963, and
  5. one Hourly Employee with a wage of $20/hour working for 40 hours and a birthday of April 1, 1964

You should make up your own employee names for the five required employees above. Make sure you create the employees in the order above.

In prompting the user for all input values for the five employees above, your programessentially replaces the existing main() method of PayrollSystemTest.java. You may user whatever input class you want (e.g. JOptionPane, Scanner). Keep all other lines of the code in PayrollSystemTest as they are originally, including the code that gives a 10% increase to the Base Plus Commission employee.

You will probably find it helpful to prompt for the worker type first. You may

hardcode "November" as the special bonus month.

Since the outputs are to be for monthly paychecks, just multiply the weekly

salaries, weekly output quantities, and weekly hours by 4. Display your results

for each worker's salary after all data for that employee type has been entered

and the salary determined.

Your output should appear like the example below (using the current examples in the code for PayrollSystemTest (the "Employees processed individually" portion isn't shown, and monthly salaries are shown below as required by this program vs. weekly salaries that would be produced from the unmodified code). Note that the test data is shown below. Your five employees will create a different set of outputs. After you verify that the original program produces these results you can remove the output statements for this original data and just keep what you need for your five employees.

Employees process polymorphically:

salaried employee: John Smith

social security number: 111-11-1111

date of birth: 01/02/1960(current code won't do this but yours must)

weekly salary: $800.00

earned $3200.00

hourly employee: Karen Price

social security number: 222-22-2222

date of birth: 01/02/1960(current code won't do this but yours must)

hourly wage: $16.75; hours worked: 40.00

earned $2680.00

commission employee: Sue Jones

social security number: 333-33-3333

date of birth: 01/02/1960(current code won't do this but yours must)

gross sales: $10,000.00; commission rate: 0.06

earned $2400.00

base-salaried commission employee: Bob Lewis

social security number: 444-44-4444

date of birth: 01/02/1960(current code won't do this but yours must)

gross sales: $5,000.00; commission rate: 0.04; base salary: $300.00

new base salary with 10% increase is: $330.00

earned: $2120.00

Employee 0 is a SalariedEmployee

Employee 1 is a HourlyEmployee

Employee 2 is a CommissionEmployee

Employee 3 is a BasePlusCommissionEmployee

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

=+Are there shop stewards?

Answered: 1 week ago