Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Driver Program for the Employee Class
- */
- import java.util.*;
- import java.io.*;
- public class Project2 {
- final static int ARR_SIZE = 10;
- public static void main(String [] args) {
- // Print out your name and project heading.
- // Declare your array of arraySize Employees here, call it empArr.
- Employee [] empArr; // finish
- // Initialize empArr[0] to the default Employee value
- // Initialize the remaining empArr values here, using initEmpArr
- // Don't touch the next few lines... they're good. Just finish the initEmpArray
- // method.
- try {
- initEmpArray(empArr);
- }
- catch (Exception e) {
- System.out.println(e + "\n"+ "Exiting.");
- System.exit(0);
- }
- // print out all employees here. You'll need to update the parameter list!
- printEmp(empArr);
- // Update the payRate here
- // Update the odd indexed employees to increase their hours here.
- // Update empArr[0] to have a name of Billy Bob Thornton
- // print it all out again
- printEmp(empArr);
- }
- public static void printEmp(Employee [] empArr) {
- for (int i=0; i<empArr.length; i++ ) {
- System.out.println(empArr[i]);
- }
- }
- public static void initEmpArray(Employee [] empArr) throws Exception {
- Scanner mysc = new Scanner(new File ("empdata.txt"));
- for (int i=1; i<empArr.length; i++) {
- // read in a line of data using mysc. Then construct this employee with the data.
- // notice we start with i=1 because we already initialized empArr[0].
- // construct the Employee object here.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement