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

Purpose: Build an application to calculate an Employee\'s Gross Pay and a Depart

ID: 3877371 • Letter: P

Question

Purpose: Build an application to calculate an Employee's Gross Pay and a Department's Average Pay Report Requirements: Build an application to allow the end-user to calculate an Employee's Gross Pay and the Department's average Gross Pay Report. First, the user will enter each employee's name, hours worked and hourly pay rate into parallel arrays. Then the application calculates and displays each Employee's Full Name and Payroll Information (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: 1. 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 cach employee)

Explanation / Answer

Note : Could you please check the output .If you required any changes Just intimate.I will modify it.Thank You.

______________

GrossPay.java

import java.util.Scanner;

public class GrossPay {

public static void main(String[] args) {

//Declaring variables

String names[]=new String[3];

double workedHours[]=new double[3];

double grossPay[]=new double[3];

double payRate[]=new double[3];

double deptAvg,tot=0;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

for(int i=0;i<names.length;i++)

{

//Getting the input entered by the user

System.out.print("Enter the name :");

names[i]=sc.nextLine();

  

System.out.print("Enter no of worked Hours :");

workedHours[i]=sc.nextDouble();

  

System.out.print("Enter PayRate :");

payRate[i]=sc.nextDouble();

  

sc.nextLine();

  

if(workedHours[i]<=40)

{

grossPay[i]=workedHours[i]*payRate[i];

}

else

{

grossPay[i]=40*payRate[i]+(workedHours[i]-40)*1.5*payRate[i];

}

  

tot+=grossPay[i];

}

System.out.println("Name Hours Pay Rate Gross Pay");

for(int i=0;i<names.length;i++)

{

System.out.println(names[i]+" "+workedHours[i]+" "+payRate[i]+" "+grossPay[i]);

}

System.out.printf(" Department Average :%.2f",tot/names.length);

}

}

___________________

Output:

Enter the name :Smith,Joe

Enter no of worked Hours :40

Enter PayRate :10.00

Enter the name :Smith,Sally

Enter no of worked Hours :30

Enter PayRate :20.50

Enter the name :Smith,Chris

Enter no of worked Hours :50

Enter PayRate :10.00

Name Hours Pay Rate Gross Pay

Smith,Joe 40.0 10.0 400.0

Smith,Sally 30.0 20.5 615.0

Smith,Chris 50.0 10.0 550.0

Department Average :521.67

__________________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote