Question
Exercise 2: A company runs a small factory. You need to create a pay slip for the employees of the company. The details of the
Exercise 2: A company runs a small factory. You need to create a pay slip for the employees of the company. The details of the Java application to be implemented is provided below.
A. The factory workers are paid one of the three hourly rates depending on their skill level.
Write a method to that takes the skill level as a parameter and returns the hourly rate. Use the switch construct in Java.
Skill Level Hourly Rate (dirham)
A 100 B 70 C 35
B. Each factory worker might work any number of hours per week; any hour over 40 are paid at double rate.
Write a method that takes the hours worked and calculates the gross pay depending on if there is overtime or not. Return the gross pay from the method.
C. Factory workers have extra benefits. Only workers in skill level A can choose to participate in the Retirement Plan at 5% of their gross pay. Also, The workers in all skill levels can choose to participate in the following insurance options:
Option
1 2 3
Explanation
Medical Insurance Dental Insurance Disability Insurance
Weekly Cost to Employee (dirham)
150 95 65
Write a method that takes the workers skill level and gross pay as parameter and asks the user the necessary questions to decide on benefits (Insurance and/or Retirement). The user must be given the choice to choose all three types of Insurances. The method must return the net pay after deducting the benefits if the worker chooses to obtain these benefits.
-
Ask the user to enter the details of all employees. The details include: Employee ID, Name, Skill level, and Working Hours per Week should entered in the main method. The Retirement and Insurance benefits should be asked from the User in the above method.
-
Generate a pay slip for each employee i.e. if the user enters 10 employees, then 10 pay slips are to be generated. Each pay slip is written to a separate file with the name given as the employee id. For example: if the employee id is A11P9, then the file A11P9.txt will contain the pay slip of the employee. The pay slip for each worker must contain the following details in a neat and readable format.
-
The ID, Name, and skill level of the Factory Worker
-
The total number of working hours of the factory worker
-
The hourly rate
-
The gross pay of a factory worker i.e. before the deductions
-
The net pay i.e. Gross pay Total deductions
-
using java programing language
-
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