Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Device an employee payroll program that uses polymorphism to calculate and print the weekly payroll for your company. There are three types of employees

  1. Device an employee payroll program that uses polymorphism to calculate and print the weekly payroll for your company. There are three types of employees ─ hourly, salaried, and salaried plus commission. Each type of employee gets paid using a different formula. But for all employee types, if the calculated paycheck exceeds $1000, the actual paycheck must be decreased to $1000.
  2. Employee class:
  3.  
  4. Instance variables:
  5. name
  6. social security number
  7. birthday month
  8. birthday week.
  9.  
  10. load method :
  11. Prompts the user for instance-variable values and loads the entries.
  12.  
  13. toString method:
  14. Returns a string that shows the employee's name, social security number, and paycheck..  Use the String.format method (See Java API documentation to help you format the string as shown in the sample session's paycheck report.) Here's an example from the sample session:
  15. employee: Biff Sanchez
  16. social security number: 111-11-1111
  17. paycheck: $800.00
  18.  
  19. getBonus method:
  20. Generates a $100 employee birthday bonus. Compare the employee's birthday with the current date found on your computer system. Use the Calendar class to generate the current date. (See the Java API documentation.) If the employee's birthday month and birthday week match your computer system's current month and current week, then increment the employee's paycheck by $100. The birthdayMonth holds the month (1─12) in which the employee was born. The birthdayWeek holds the week (1─4) that the employee chooses to get paid his/her bonus.
  21.  
  22. Hourly class:
  23.  
  24. Instance variables:
  25. hourly pay
  26. hours worked during the past week
  27.  
  28. load method:
  29. Prompts the user for instance-variable values and loads the entries.
  30.  
  31. Include a getEarnings method that calculates earnings for an hourly employee. Hourly employees are paid by the hour. If they work more than 40 hours in a week, then they receive overtime pay for their overtime work. Overtime pay equals one and a half times their normal hourly pay.
  32.  
  33. Salaried class:
  34.  
  35. Instance variables:
  36. weekly salary
  37.  
  38. load method:
  39. Prompts the user for instance-variable values and loads the entries.
  40.  
  41. Include a getEarnings method that calculates earnings for a salaried employee. Salaried employees are paid their fixed weekly salary regardless of the number of hours they work.
  42.  
  43. SalariedPlusCommission class:
  44.  
  45. Instance variables:
  46. sales during the past week
  47. commission rate
  48.  
  49. load method:
  50.  
  51. Prompts the user for instance-variable values and loads the entries.
  52.  
  53. Include a getEarnings method that calculates earnings for a SalariedPlusCommission employee. SalariedPlusCommission employees are paid a base salary plus a percentage of their sales. "Percentage of their sales" equates to the product of their sales times their commission rate.
  54.  
  55. Use initially declared named constants instead of hardcoded "magic numbers" embedded in the program. In the Employee class, include a getEarnings method that is abstract.
  56.  
  57. Use the public access modifier for the toString method in the Employee class
  58. and the load method in the Employee, Hourly, Salaried, and SalariedPlusCommission classes.
  59.  
  60. Provide a driver that generates the following queries and outputs.
  61.  
  62. Sample session (assuming current month = 10 and current week = 2):
  63.  
  64. Number of employees: 3
  65.  
  66. PROFILE FOR EMPLOYEE #1:
  67. type Hourly(1), Salaried(2), Salaried plus Commission(3)
  68. Enter 1, 2, or 3 ==> 1
  69. Name ==> Biff Sanchez
  70. Social security number ==> 111-11-1111
  71. Birthday month (1-12) ==> 2
  72. Birthday bonus week (1-4) ==> 3
  73. Hourly pay ==> 20
  74. Hours worked this past week ==> 30
  75.  
  76. PROFILE FOR EMPLOYEE #2:
  77. type Hourly(1), Salaried(2), Salaried plus Commission(3)
  78. Enter 1, 2, or 3 ==> 2
  79. Name ==> Dirk Jones
  80. Social security number ==> 222-22-2222
  81. Birthday month (1-12) ==> 10
  82. Birthday bonus week (1-4) ==> 2
  83. Salary ==> 700
  84.  
  85. PROFILE FOR EMPLOYEE #3:
  86. type Hourly(1), Salaried(2), Salaried plus Commission(3)
  87. Enter 1, 2, or 3 ==> 3
  88. Name ==> Suzie Que
  89. Social security number ==> 333-33-3333
  90. Birthday month (1-12) ==> 7
  91. Birthday bonus week (1-4) ==> 3
  92. Salary ==> 400
  93. Sales for this past week ==> 2000
  94. Sales commission rate (fraction paid to employee) ==> .25
  95.  
  96. employee: Biff Sanchez
  97. social security number: 111-11-1111
  98. paycheck: $600.00
  99.  
  100. employee: Dirk Jones
  101. social security number: 222-22-2222
  102. paycheck: $800.00
  103.  
  104. employee: Suzie Que
  105. social security number: 333-33-3333
  106. paycheck: $900.00

Step by Step Solution

3.42 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

Employeejava Employeejava Your Name Here This class handles payroll processing for an employee import javatextDecimalFormat import javautilScanner import javautilCalendar public abstract class Employe... 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

Integrated Accounting

Authors: Dale A. Klooster, Warren Allen, Glenn Owen

8th edition

1285462726, 1285462721, 978-1285462721

More Books

Students also viewed these Programming questions

Question

3. If possible, break the presentation into clear steps or stages.

Answered: 1 week ago

Question

Determine Leading or Lagging Power Factor in Python.

Answered: 1 week ago

Question

What account number is assigned to Utilities Expense?

Answered: 1 week ago