Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. /**
  2. * Driver Program for the Employee Class
  3. */
  4. import java.util.*;
  5. import java.io.*;
  6.  
  7. public class Project2 {
  8. final static int ARR_SIZE = 10;
  9. public static void main(String [] args) {
  10.  
  11. // Print out your name and project heading.
  12.  
  13.  
  14.  
  15. // Declare your array of arraySize Employees here, call it empArr.
  16. Employee [] empArr; // finish
  17.  
  18.  
  19. // Initialize empArr[0] to the default Employee value
  20.  
  21.  
  22. // Initialize the remaining empArr values here, using initEmpArr
  23. // Don't touch the next few lines... they're good. Just finish the initEmpArray
  24. // method.
  25. try {
  26. initEmpArray(empArr);
  27. }
  28. catch (Exception e) {
  29. System.out.println(e + "\n"+ "Exiting.");
  30. System.exit(0);
  31. }
  32.  
  33. // print out all employees here. You'll need to update the parameter list!
  34. printEmp(empArr);
  35.  
  36.  
  37. // Update the payRate here
  38.  
  39.  
  40.  
  41. // Update the odd indexed employees to increase their hours here.
  42.  
  43.  
  44.  
  45. // Update empArr[0] to have a name of Billy Bob Thornton
  46.  
  47.  
  48.  
  49. // print it all out again
  50. printEmp(empArr);
  51.  
  52.  
  53. }
  54.  
  55. public static void printEmp(Employee [] empArr) {
  56.  
  57. for (int i=0; i<empArr.length; i++ ) {
  58. System.out.println(empArr[i]);
  59. }
  60.  
  61.  
  62. }
  63.  
  64.  
  65. public static void initEmpArray(Employee [] empArr) throws Exception {
  66. Scanner mysc = new Scanner(new File ("empdata.txt"));
  67.  
  68. for (int i=1; i<empArr.length; i++) {
  69.  
  70. // read in a line of data using mysc. Then construct this employee with the data.
  71. // notice we start with i=1 because we already initialized empArr[0].
  72.  
  73.  
  74. // construct the Employee object here.
  75.  
  76. }
  77.  
  78. }
  79.  
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement