In: Computer Science
RUN THIS PROGRAM ON NETBEANS
As a Software Developer, you have received a requirement from a Company to implement a
prototype for its payroll system.
You receive the following specifications:
If an employee works more than its regular hours, it is considered overtime and it will be
paid based on the employee’s experience.
All employees are paid biweekly (80 hours)
Employee taxes: 1%
This company manages three categories of workers based on employee’s experience.
Group 1 (Silver)
o Pay rate: $20 per hour
o Regular hours: 80 hours(biweekly)
o Overtime Factor 1.5
o Retirement plan (2% of the gross pay)
o Health insurance ($250)
Group 2 (Golden)
o Pay rate: $25 per hour
o Regular hours: 80 hours(biweekly)
o Overtime Factor 2
o Retirement plan (3% of the gross pay)
o Health insurance ($200)
Group 3 (Platinum)
o Pay rate: $30 per hour
o Regular hours: 80 hours(biweekly)
o Overtime Factor 2.5
o Retirement plan (3.5% of the gross pay)
o Health insurance ($150)
Your program should prompt the user (customer) to enter the following information:
Employee’s name
Number of hours worked
Employee group (1 Silver , 2 Golden or 3 Platinum)
-----The program then outputs the following
information:
Employee’s name
Type of Employee (“Silver”, “Golden” or “Platinum”– not 1, 2 or 3)
Total number of hours worked.
Hourly pay rate
Gross Pay
Retirement deduction
Insurance deduction
Employee taxes
Net pay
Thanks for the question. Here is the completed code for this problem. Let me know if you have any doubts or if you need anything to change. Thank You !! ================================================================================================ import java.util.Scanner; public class EmployeePayroll { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter Employee's name: "); String employeeName = scanner.nextLine(); System.out.print("Enter Number of hours worked: "); int hoursWorked = scanner.nextInt(); System.out.print("Select Employee Group ([1]Silver [2]Golden [3]Platinum): "); int group = scanner.nextInt(); switch (group) { case 1: silverPaySlip(employeeName, hoursWorked); break; case 2: goldenPaySlip(employeeName, hoursWorked); break; case 3: platinumPaySlip(employeeName, hoursWorked); break; default: System.out.println("Invalid group selected."); } } private static void platinumPaySlip(String employeeName, int hoursWorked) { double grossPay = hoursWorked<=80?hoursWorked*30 : (80*30 + (hoursWorked-80)*30*2.5); System.out.println("Employee Name: " + employeeName); System.out.println("Type of Employee: " + "Silver"); System.out.println("Total number of hours worked: " + hoursWorked + " hrs"); System.out.println("Hourly Rate: $" + 30.00); System.out.println("Gross Pay: $" + grossPay); System.out.println("Retirement Deduction: $" + String.format("%.2f",0.035 *grossPay)); System.out.println("Insurance Deduction: $" + 150); System.out.println("Employee Taxes: $" + String.format("%.2f",0.01 * grossPay)); double netPay = grossPay - (0.035 * grossPay + 150 + 0.01 * grossPay); System.out.println("Net Pay: $"+String.format("%.2f",netPay)); } private static void goldenPaySlip(String employeeName, int hoursWorked) { double grossPay = hoursWorked<=80?hoursWorked*25 : (80*25 + (hoursWorked-80)*25*2); System.out.println("Employee Name: " + employeeName); System.out.println("Type of Employee: " + "Silver"); System.out.println("Total number of hours worked: " + hoursWorked + " hrs"); System.out.println("Hourly Rate: $" + 25.00); System.out.println("Gross Pay: $" + grossPay); System.out.println("Retirement Deduction: $" + String.format("%.2f",0.03 *grossPay)); System.out.println("Insurance Deduction: $" + 200); System.out.println("Employee Taxes: $" + String.format("%.2f",0.01 * grossPay)); double netPay = grossPay - (0.03 * grossPay + 200 + 0.01 * grossPay); System.out.println("Net Pay: $"+String.format("%.2f",netPay)); } private static void silverPaySlip(String employeeName, int hoursWorked) { double grossPay = hoursWorked<=80?hoursWorked*20 : (80*20 + (hoursWorked-80)*20*1.5); System.out.println("Employee Name:a " + employeeName); System.out.println("Type of Employee: " + "Silver"); System.out.println("Total number of hours worked: " + hoursWorked + " hrs"); System.out.println("Hourly Rate: $" + 20.00); System.out.println("Gross Pay: $" + grossPay); System.out.println("Retirement Deduction: $" + String.format("%.2f",0.02 *grossPay)); System.out.println("Insurance Deduction: $" + 250); System.out.println("Employee Taxes: $" + String.format("%.2f",0.01 * grossPay)); double netPay = grossPay - (0.02 * grossPay + 250 + 0.01 * grossPay); System.out.println("Net Pay: $"+String.format("%.2f",netPay)); } }
=======================================================================================