Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here\'s the input Purpose: Build an application to calculate an Employee\'s Gros

ID: 3881265 • Letter: H

Question

Here's the input

Purpose: Build an application to calculate an Employee's Gross Pay and a Department's Total Gross-Pay- Out Report. This lab will be a file-processing lab based off chapter #7 Requirements: Build an application to allow a department to calculate each Employee's Gross Pay and the Department's Total Gross-Pay-Out Report. First, the application will read information from the input file (Employees.txt). The app reads for each employee (name, hours worked and hourly pay) into parallel arrays. Then the application calculates gross pay and writes each Employee's Full Name and Payroll Information to the output file (Payroll txt) (see both inputs and outputs listed in the tables below). Assumptions: 1. Assume your department has 10 employees (or less). 2. Gross Pay (Regular hours pay rate) + (Over Time hours pay rate 1.5) a. Regular hours are less than or equal to 40 Language: JAVA Techniques: Your successful program will implement the following program techniques . Arrays and Array Processing-(Arrays will hold employee information) 2. Methods -(Most of your process should be in methods) 3. Decisions - (Enter only hours worked Your application calculates regular and overtime hours) 4. Loops (For processing each employee) 5. Files Processing - (Input file Employees.txt Output file- Payroll.txt) Table 1- Data Requirements Data Requirements Input Employee Info Input File Employees.txt Fields Data T En First Narme Last Name Total Hours Worked Pav Rate tring Double Currency or Double Seth Smith 55.5 12.50 Processes Read Input Record Calculate Gross Pay Write Out Records Output Output File Payrolltxt Format see below) Employee's Full Name Pay Rate Employee's Gross Pay Department Total Gross Pay Build in GUI Advanced Smith Joe,40,10.00

Explanation / Answer

Employees.txt

Smith,Seth,55.5,12.50
Jones,Adam,40.5,5.50
Levis,Chris,50.0,10.00
Machado,Manny,45.5,5.50
Hardy,J.J,40.0,17.25
Schoop,Jon,45.0,23.80
Richard,Joey,40.0,35.00
Walker,Chris,25.5,13.00
Trumbo,Mark,30.0,11.0
Joseph,Caleb,20.5,10.00

____________

Payroll.java

import java.io.BufferedWriter;

import java.io.File;

import java.io.FileNotFoundException;

import java.io.FileWriter;

import java.io.IOException;

import java.text.DecimalFormat;

import java.util.Scanner;

public class Payroll {

public static void main(String[] args) {

//Declaring variables

int i = 0;

double totalgrossPay = 0.0, grossPay = 0;

//Creating Arrays

String name[] = new String[10];

double workedHours[] = new double[10];

double payR[] = new double[10];

Scanner sc = null;

// DecimalFormat class is used to format the output

DecimalFormat df = new DecimalFormat(".00");

FileWriter fw;

try {

//Opening the input file

sc = new Scanner(new File("Employees.txt"));

//Reading the data from the input file

while (sc.hasNext()) {

String str = sc.nextLine();

String s[] = str.split(",");

name[i] = s[0] + " " + s[1];

workedHours[i] = Double.parseDouble(s[2]);

payR[i] = Double.parseDouble(s[3]);

i++;

}

} catch (FileNotFoundException e) {

e.printStackTrace();

}

//closing the input file

sc.close();

try {

//Opening the output file

fw = new FileWriter(new File("Payroll.txt"));

BufferedWriter bw = new BufferedWriter(fw);

//Writing the data to the output file

for (int j = 0; j < 10; j++) {

bw.write(name[j] + " ");

if (workedHours[j] <= 40) {

grossPay = workedHours[j] * payR[j];

} else if (workedHours[j] > 40) {

grossPay = 40 * payR[j] + (40 - workedHours[j]) * 1.5 * payR[j];

}

bw.write(df.format(grossPay) + " ");

totalgrossPay += grossPay;

bw.newLine();

}

bw.newLine();

bw.write("Total Gross Pay of all Employees :" + df.format(totalgrossPay));

//closing the output file

bw.close();

} catch (IOException e) {

e.printStackTrace();

}

}

}

________________

Output file:

Payroll.txt

Smith Seth 209.38
Jones Adam 215.88
Levis Chris 250.00
Machado Manny 174.62
Hardy J.J 690.00
Schoop Jon 773.50
Richard Joey 1400.00
Walker Chris 331.50
Trumbo Mark 330.00
Joseph Caleb 205.00

Total Gross Pay of all Employees :4579.88

_______________Could you plz rate me well.Thank You