Write a Java application with a class name of Payroll, for the
“Travel Agency”, that willCalculate the weekly paycheck for both Salaried and Hourly employees. Salaried employees will be paid 1/52 of their annual pay minus 18% withheld for federal and state taxes, as well as 4% for retirement pension.
Salaried employees do not collect overtime pay.
There are two types of Hourly employees; permanent employees and temporary weekly employees.
•Permanent weekly employees will be paid their hourly rate minus 18% withheld for federal and state taxes.
•Temporary weekly employees will be paid their hourly rate and are Tax Exempt.
•Hourly employees are paid time and a half if an employee works more than 40hours per week.
Assignment Task(s):
***********DO NOT USE CHAR TYPE************
You must define an enumerated type specifying the different employee types. You must define an enumerated type of EMPLOYEE_TYPE that defines the different types; Salaried, Hourly, Temporary, Quit and Unknown.
You must define a MAXIMUM_EMPLOYEE constant and set it to 4
. You must define a static method called getEmployeeType which accepts the user string input and returns the enumerated employee type.
Your application must implement a “while” loop to determine if the program should continue to prompt for employee information or “Quit”, based on the employee type entered.
The while loop must also exit automatically after the maximum number of employees have been entered.
After the employee name has been entered, you Must use a switch statement to determine the next course of action dependent on the employee type
. Your switch statement will use the enumerated employee type as the controlling variable.
Depending on the employee type, you will prompt the user for either their yearly or hourly salary. Your application will calculate the weekly gross salary, any deductions and the weekly net salary.
Your switch statement for each employee type should only prompt for the information it needs to calculate the appropriate wages, taxes and pension (if applicable).
The output will consist of the employee’s name, their weekly gross pay, any deductions and their weekly net pay. If the employee is a Temporary employee, the string “No Taxes Deducted” should appear in the weekly net pay column.
program must have the following
Properly defining enumerated employee type
Properly defining MAXIMUM_EMPLOYEE constant, setting to 5
Properly defining static getEmployeeType method, providing a String parameter and returning the proper enumerated type
Implementation of while loop to control properly exiting the application when quit is entered or when the maximum number of 5 employees has been entered.
Implementation of switch statement for properly prompting, reading and displaying appropriate employee information
Proper implementation of Salaried employee
Proper implementation of Hourly employee
Proper implementation of Temporary employee
please follow sample run
sample run:
EnterEmployee Type [Salaried], [Hourly], [Temporary] or [Quit]: salaried
Enter Employee First Name: Robert
Enter Employee Last Name : Mitchum
Robert Mitchum's Yearly Salary: $63500
Employee : Robert Mitchum
Gross Wages : $1221.15
Taxes Withheld : $219.81
Retirement Withheld : $48.85
Net Wages : $952.50
Enter Employee Type [Salaried], [Hourly], [Temporary] or [Quit]: Hourly
Enter Employee First Name: Danny
Enter Employee Last Name : Kaye
Danny Kaye's Hourly Salary: $10.50
Enter Danny Kaye's Number of Hours: 50
Employee : Danny Kaye
Gross Wages : $577.50
Taxes Withheld : $103.95
Net Wages : $473.55
Enter Employee Type [Salaried], [Hourly], [Temporary] or [Quit]: temporary
Enter Employee First Name: Cornelius
Enter Employee Last Name : Ryan
Cornelius Ryan's Hourly Salary: $8.50
Enter Cornelius Ryan's Number of Hours: 46
Employee : Cornelius Ryan
Gross Wages : $416.50
NO Taxes Deducted
Enter Employee Type [Salaried], [Hourly], [Temporary] or [Quit]: sal
Unknown Employee Type, Please Reenter: quit
Please find my implementation:
//Include the header files.
import java.io.*;
import java.lang.String;
import java.util.*;
//define the class payroll
public class Payroll1 {
//Main function.
public static void main(String[] args)
{
//Declare the array.
String []first = new
String[6];
String []last = new
String[6];
double []wages = new
double[6];
int i=0,j=0,k=0;
//Scanner object.
Scanner sc = new
Scanner(System.in);
double gross, taxes, retirement,
Wages, e_salary;
String f_name, l_name;
int numOfHours;
//While loop.
while(true)
{
//Prompt the
user to enter the employee type.
System.out.println("Enter Employee Type [S]alaried, [H]ourly,
[T]emporary, [Q]uit: ");
char type_em =
sc.next().charAt(0);
//Switch case
for employee type.
switch(type_em)
{
case
's':
case 'S':
//Prompt the user to enter the details if the
type of employee is salaried.
System.out.println("Enter Employee First Name:
");
f_name = sc.next();
System.out.println("Enter Employee Last Name:
");
l_name = sc.next();
System.out.print(f_name + " " + l_name + "'s
Yearly e_salary: ");
e_salary = sc.nextDouble();
System.out.print("Enter" + f_name + " " + l_name
+ "'s Number of hours: ");
numOfHours = sc.nextInt();
System.out.println("Employee: " + f_name +
l_name);
gross = e_salary/52;
taxes = gross*.18;
retirement = gross*.04;
Wages = gross - taxes - retirement;
first[i] = f_name;
last[i] = l_name;
wages[i] = Wages;
i++;
System.out.printf("Gross Wages: $%.2f\n",
gross);
System.out.printf("Taxes With Held: $%.2f\n",
taxes);
System.out.printf("Retirement WithHeld:
$%.2f\n", retirement);
System.out.printf("Net Wages: $%.2f\n",
Wages);
break;
case
'h':
case 'H':
//Prompt the user to enter the details if the
type of employee is hourly paid.
System.out.println("Enter Employee First Name:
");
f_name = sc.next();
System.out.println("Enter Employee Last Name:
");
l_name = sc.next();
System.out.print(f_name + " " + l_name + "'s
Hourly e_salary: ");
e_salary = sc.nextDouble();
System.out.print("Enter" + f_name + " " + l_name
+ "'s Number of hours: ");
numOfHours = sc.nextInt();
System.out.println("Employee: " + f_name +
l_name);
gross = e_salary*numOfHours;
taxes = gross*.18;
Wages = gross - taxes;
first[i] = f_name;
last[i] = l_name;
wages[i] = Wages;
i++;
System.out.printf("Gross Wages: $%.2f\n",
gross);
System.out.printf("Taxes WithHeld: $%.2f\n",
taxes);
System.out.printf("Net Wages: $%.2f\n",
Wages);
break;
case
't':
case 'T':
//Prompt the user to enter the details if the
type of employee is temporarily paid.
System.out.println("Enter Employee First Name:
");
f_name = sc.next();
System.out.println("Enter Employee Last Name:
");
l_name = sc.next();
System.out.print(f_name + " " + l_name + "'s
Hourly e_salary: ");
e_salary = sc.nextDouble();
System.out.print("Enter" + f_name + " " + l_name
+ "'s Number of hours: ");
numOfHours = sc.nextInt();
gross = e_salary*numOfHours;
if(numOfHours > 35)
{
gross +=
e_salary*(numOfHours-35)*0.5;
}
first[i] = f_name;
last[i] = l_name;
wages[i] = gross;
i++;
System.out.println("Employee: " + f_name +
l_name);
System.out.println("Gross Wages: $" +
gross);
System.out.println("No Taxes Deducted");
break;
case
'q':
case 'Q':
//Prompt the user to enter the choice if the
user enter quit.
System.out.println("Display Employees: Sort by
[L]ast Name, [W]ages or [Q]uit: ");
char type = sc.next().charAt(0);
switch(type)
{
//Sorting according to last name.
case 'l':
case 'L':
String temp;
for(int m=0; m<i;
m++)
{
for(int
n=0; j<i; j++)
{
int t = (last[n]).compareTo(last[n+1]);
if(t>0)
{
temp = first[n];
first[n] = first[n+1];
first[n+1] = temp;
}
}
}
System.out.println();
System.out.println("Sorting
according to last name: ");
//Print the names of
employees'.
for(int p=0; p<i;
p++)
{
System.out.println(first[p]);
}
break;
//Sorting according to
wages.
case 'w':
case 'W':
for(int m=0; m<i;
m++)
{
for(int
n=0; j<i; j++)
{
if(wages[n] > wages[n+1])
{
temp = first[n];
first[n] = first[n+1];
first[n+1] = temp;
}
}
}
System.out.println();
System.out.println("Sorting
according to wages: ");
//Print the names of
employees'.
for(int p=0; p<i;
p++)
{
System.out.println(first[p]);
}
break;
case 'q':
case 'Q':
return;
}
return;
default:
System.out.println("Invalid Employee Type:
");
}
}
}
}
![Enter Employee Type [S]alaried, [H]ourly, [T]emporary, [Qluit: Enter Employee First Name: Robert Enter Employee Last Name: Mi](http://img.homeworklib.com/questions/b76962a0-b89a-11ea-be41-4fd64458b06c.png?x-oss-process=image/resize,w_560)
Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate...
Within c++ Create a simple Employee class with name, department, and title. Create an hourlyEmployee class (which inherits from the Employee class) for a basic payroll program to compute the net pay salary of hourly based employees. Your program should also find the average net pay for a small company. To define the class, include the appropriate data members, member functions, constructors, and access modifiers. For simplicity, use a constant tax rate of 30% to compute the tax amount. Employees...
Code a complete Java program for the following payroll application: First, hard code the following data for the object ‘Employee’ into 4 separate arrays: SSN: 478936762, 120981098, 344219081, 390846789, 345618902, 344090917 First name : Robert, Thomas, Tim, Lee, Young, Ropal Last name : Donal, Cook, Safrin, Matlo, Wang, Kishal Hourly rate : 12.75, 29.12, 34.25, 9.45, 20.95, 45.10 Hours worked: 45, 40, 39, 20, 44, 10 These 4 arrays must be declared inside the class and not within any method....
java Payroll class Exceptions Programming Challenge 5 of Chapter 6 required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions: • An empty string is given for the employee’s name. • An invalid value is given for the employee’s ID number. If you implemented this field as a string, then an empty string would be invalid. If you implemented this field as a numeric variable, then a negative number or...
Payroll Application Problem Description: An org needs a payroll application which has the capability to calculate and print the monthly pay of an employee. The application starts by printing a short description of what it does. Then, it asks for the employee name. Next, the application prompts for employee type (“H” for hourly and “S” for salaried.) If the user enters S, the gross pay is set to $4000. However, if the user enters H for an hourly employee, the...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who receive a fixed amount of money per item for each of the items they produce-each pieceworker in this company works on only one...
create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...
Assignment Four (T) Compatiblity Mode 4 Weekly Payroll. Wnite a Java program to create a weekly payroll using the following Adrated Weekly Income Income Tax Withheld $0 to $124 Over $124 to $399 Over $899 to $1,85 Over $1,855 to 53,064 Over $3,084 to $3,439 Over $5,439 Tax Guide. Your program should request the following information employee id number (integer), hourly wage, hours worked per week, number of with holding exemptions, manital status (use a code 0 and 1 or...
in Python
Project 5: Payroll (Part 1) CS 1410 Background In this project you will implement a simple payroll system. For the first part of the assignment, you will submit a UML class diagram. The hypothetical company we are considering has 3 classifications of employees: 1. Hourly 2. Salaried 3. Commissioned There are 24 pay periods per year; 1/24th of a salary is paid each pay period to employees who receive a salary. We won't worry about taxes and other...
write in java and please code the four classes with the
requirements instructed
You will be writing a multiclass user management system using the java. Create a program that implements a minimum of four classes. The classes must include: 1. Employee Class with the attributes of Employee ID, First Name, Middle Initial, Last Name, Date of Employment. 2. Employee Type Class that has two instances of EmployeeType objects: salaried and hourly. Each object will have methods that calculates employees payrol...
Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user for type of employee (hourly ("h"or "H") or management ("'m" or "M") If the employee is management: . get the annual salary get the pay period (weekly ("w" or "W"), bi-weekly ("b" or "B") or monthly ("m" or e compute the gross salary for the pay period (Divide annual salary by 52 for weekly, 26 for bi-weekly, and 12 for monthly) deduct from gross...