Advertisement
Ccuevas3410

Untitled

Sep 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package payroll;
  7.  
  8. /**
  9. *
  10. * @author crist
  11. */
  12.  
  13. import java.util.Scanner;
  14. public class Payroll {
  15.  
  16. public static int employeeId[]= {5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489};
  17.  
  18. public static final int[] hours = new int[7];
  19. public static final double[] payRate = new double[7];
  20. public static final double[]wages = new double [7];
  21.  
  22. public static Scanner input = new Scanner(System.in);
  23.  
  24. public static void main(String[] args) {
  25.  
  26.  
  27.  
  28.  
  29. System.out.println("Hello, here are the employee's # ID");
  30.  
  31. for (int i = 0; i < employeeId.length; i++) {
  32.  
  33. System.out.printf(employeeId[i] + " \t " );
  34. System.out.println(" ");}
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. for (int a = 0; a < hours.length; a++) {
  42.  
  43. System.out.println("Enter employee " + (a+1
  44. ) + " number of hours. (No less than 0 hours)");
  45.  
  46. hours[a] = input.nextInt();
  47.  
  48. if (hours[a] < 0) {
  49. a--;
  50. System.out.println("Error, Invalid Input. Re-Enter hours between 0 and ∞.");
  51. } else {
  52. System.out.println("Enter employee " + (a+1) + " Payrate. (No less than 6$ per hour)");
  53.  
  54. payRate[a]= input.nextDouble();
  55.  
  56.  
  57. if (payRate[a] < 6.00) {
  58. a--;
  59. System.out.println("Error, Invalid Input. Re-Enter payrate between 6 and ∞.");
  60. } else {
  61. System.out.println(" ");
  62. }
  63.  
  64.  
  65.  
  66.  
  67. }
  68.  
  69. }
  70.  
  71. System.out.println("Employee's ID " + " \t Gross wages ");
  72.  
  73. for (int i = 0; i < employeeId.length; i++) {
  74.  
  75. wages[i] = (double)(hours[i] * payRate[i]);
  76. System.out.println(employeeId[i] + "\t \t \t " + wages[i] + "$");
  77.  
  78.  
  79.  
  80. }
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement