Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answers 01 import java.util.Scanner; 02 public class Payroll 03 04 { 05 private int[] employeeId = {5658845,4520125,7895122,8777541,8451277,1302850,7580489}; 06 07 private int[] hours = new int[7];

answers 01 import java.util.Scanner; 02 public class Payroll 03 04 { 05 private int[] employeeId = {5658845,4520125,7895122,8777541,8451277,1302850,7580489}; 06 07 private int[] hours = new int[7]; 08 09 private double[] payRate = new double[7]; 10 11 private double[] wages = new double[7]; 12 13 14 public Payroll() 15 { 16 Scanner kb = new Scanner(System.in); 17 18 for(int arrayIndex = 0; arrayIndex < employeeId.length; arrayIndex++) 19 { 20 System.out.println("ID " + (arrayIndex + 1) + ": " + employeeId[arrayIndex]); 21 } 22 23 for(int index = 0;index < hours.length && index < payRate.length;index++) 24 { 25 System.out.println("Please enter hours for employee number: " + (index + 1)); 26 hours[index] = (int) kb.nextDouble(); 27 28 System.out.println("Please enter payRate for employee number: " + (index + 1)); 29 wages[index] = (int) kb.nextDouble(); 30 } 31 } 32 33 public int[] getEmployeeId() { 34 return employeeId; 35 } 36 37 public void setEmployeeId(int[] employeeId) { 38 this.employeeId = employeeId; 39 } 40 41 public int[] getHours() { 42 return hours; 43 } 44 45 public void setHours(int[] hours) { 46 this.hours = hours; 47 } 48 49 public double[] getPayRate() { 50 return payRate; 51 } 52 53 public void setPayRate(double[] payRate) { 54 this.payRate = payRate; 55 } 56 57 public double[] getwages() { 58 return wages; 59 } 60 61 public void setwages(double[] ages) { 62 this.wages = ages; 63 } 64 65 public void returnGrossPay() 66 { 67 for(int arrayIndex = 0; arrayIndex < employeeId.length; arrayIndex++) 68 { 69 wages[arrayIndex] += hours[arrayIndex] * payRate[arrayIndex]; 70 71 System.out.println(" ID " + (arrayIndex + 1) + ": " + employeeId[arrayIndex] + "Gross wage is: "+ wages[arrayIndex]); 72 } 73 74 } 75 import java.util.Scanner; public class payRollDemo { public static void main(String [] args) { System.out.println(" Payroll Application "); Payroll payroll = new Payroll(); Scanner kb = new Scanner(System.in); //variable declaration int hours; double payRate; double wages; int employeeID; //loop repeats for all 7 employees for (int i=0; i <7; i++) { System.out.println("Employee : " + (i + 1)); do // get the hours { System.out.print("\t Hours: "); hours = Integer.parseInt(kb.nextLine()); } while (hours <0); payroll.setHours(i, hours); do //get the payrate { System.out.print("\t Pay Rate: "); payRate = Double.parseDouble(kb.nextLine()); } while (payRate < 6.00); payroll.setPayRate(i, payRate); employeeID = payroll.getEmployeeID(i); wages=payroll.calculateGrossPay(employeeID); payroll.setWages(i, wages); } //display each employee's identification number and gross wages. System.out.println(" "); for (int i =0; i <7; i++) { System.out.print("Employee ID: " + payroll.getEmployeeID(i)); System.out.println("\t Gross Wages: " + payroll.getWages(i)); } } } NEED HELP TO MAKE BOTH WORK TOGETHER. THANK YOU!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago

Question

5. Tell how job experiences can be used for skill development.

Answered: 1 week ago