Page 2 of 3 Detailed Specification This project is to be done as an individual a
ID: 3660977 • Letter: P
Question
Page 2 of 3 Detailed Specification This project is to be done as an individual assignment. ABC Manufacturing Ltd is a newly established manufacturing company that has a medium size work force. ABC Manufacturing staff is divided into three (3) major groups, that is, hourly paid workers, commission type workers and monthly fixed paid workers. The financial controller of the company was bombarded with complaints by staff with respect to payment delivery. Employees claimed that salaries were not being issued on time and this was mainly due to the manual system used to calculate their salary. To alleviate the problem, the financial controller demanded that a payroll program be implemented to generate salaries for ALL employees within the company. You have been contracted as a programmer by ABC Manufacturing Ltd to write a payroll program that will generate all employeesExplanation / Answer
import com.sun.java_cup.internal.runtime.Scanner; import java.util.*; public class Employee { // define your parameters private int hoursWeft = 40; private int hoursWdft = 8; private int hoursWpt = 20; private double salary = 0; private double ETF= 0.12; private java.util.Scanner s; enum PayrollDay{ MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; // constractor that calls the method that works public Employee() { makeEmployee(); } // end constructor private void makeEmployee() { // define your input s = new java.util.Scanner(System.in); int inputType = 0; double salaryMoney = 0; System.out.print("Please enter the employee type:"); System.out.println("part-time:press 1 , full-time: press 2..."); //declare keyboard as scanner type Scanner keyboard = new Scanner(System.in); //get input from the user System.out.print("Please enter a number of hours the employee worked during the weekdays: "); //declare the hours worked in weekdays int hrsWeekdays = keyboard.nextInt(); System.out.print("Please enter a number of hours the employee worked during the weekend: "); //declare the hours worked during the weekends int hrsWeekend = keyboard.nextInt(); // always work while (true) { // catches if the input is not int try { inputType = Integer.parseInt(s.next()); }//end try catch (Exception e) { inputType = 3; }// end catch if (inputType == 1 || inputType == 2) { break; } // end if System.out.print("Please enter the employee type again (only 1 or 2):"); System.out.println("part-time:press 1 , full-time: press 2..."); }// end while //enum PayrollDay{ //MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; double undertimeft; double undertimept; double overtimeft; double overtimept; double gosswage; if(inputType == 1) { // hrsWorked(); // double payFt(int hrsWeekdays,int hrsWeekend); switch(this){ case SATURDAY: case SUNDAY: salary = 100 * hoursWeft; if(hrsWeekend > hoursWeft){ int hoursWork = hrsWeekend - hoursWeft; overtimeft = 130 * hoursWork; gosswage = salary + overtimeft; }//end else if else { undertimeft = 2.5 * hrsWeekend; gosswage = salary + undertimeft; } //end else default: //weekdays salary = 100 * hoursWdft; if(hrsWeekdays > hoursWdft){ int hoursWorkw = hrsWeekdays - hoursWdft; overtimeft = 140 * hoursWorkw; gosswage = salary + overtimeft; }//end else if else { undertimeft = 12.5 * hrsWeekdays; gosswage = salary + undertimeft; } //end else break; }//end switch //return salary; salaryMoney = gosswage - (gosswage * ETF); System.out.println("The salary with reduced ETF: "+salaryMoney); } // end if else { // hrsWorked(); //double payPt(int hrsWeekdays,int hrsWeekend); switch(this){ case SATURDAY: case SUNDAY: salary = 250 * hoursWpt; if(hrsWeekend > hoursWpt){ int hoursWorked = hrsWeekend - hoursWpt; overtimept = 275 * hoursWorked; gosswage = overtimept + salary; }//end else if else { undertimept = 12.5 * hrsWeekend; gosswage = undertimept + salary; } //end else default: //weekdays salary = 250 * hoursWpt; if(hrsWeekdays > hoursWpt){ int hoursWorkedw = hrsWeekdays - hoursWdft; overtimept = 275 * hoursWorkedw; gosswage = overtimept + salary; }//end else if else { undertimept = 12.5 * hrsWeekdays; gosswage = undertimept + salary; } //end else break; }//end switch }//end enum System.out.println("the gosswage is: " + gosswage); salaryMoney = gosswage - (gosswage * ETF); System.out.println("The salary with reduced ETF: "+salaryMoney); }// end else }//end makeEmployee public static void main(String[] args) { Employee emp = new Employee(); }//end main }//end employee
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.