0
public void loadStaffList(String fileNameTwo) {
    /*
     * File format  (single spaced)
     * # of records in file
     * employee #
     * first name
     * last name
     * status (FT or PT)
     * pay (salary for FT and hourly for PT)
     * number (sick days used for FT and hours assigned for PT)
     */
    Scanner s = null;
    try {
        s = new Scanner(new BufferedReader(new FileReader(fileNameTwo)));
        int num = Integer.parseInt(s.nextLine());  // number of employees
        staffList = new Employee[num];
        for(int i=0; i<num; i++) {
            int employeeNum = Integer.parseInt(s.nextLine());
            String firstName = s.nextLine();
            String lastName = s.nextLine();
            String status = s.nextLine();
            double pay = Double.parseDouble(s.nextLine());
            double number = Double.parseDouble(s.nextLine());

            // check if FT or PT
            if (status.equals("FT")) {
                staffList[i] = new FullTimeStaff(employeeNum,firstName,lastName,pay,number);

            } else {
                // PT (assume no other options)
                staffList[i] = new PartTimeStaff(employeeNum,firstName,lastName,pay,number);

            }

            System.out.println(employeeNum);
            System.out.println(firstName + " " + lastName);
            if(staffList[i] instanceof FullTimeStaff){
                System.out.println("FT");
            }
            else {
                System.out.println("PT");
            }
            System.out.println("Pay: " + pay);
            System.out.println(number);
            System.out.println(" ");
        }
    } catch( FileNotFoundException e){
        System.out.println("File was not found!");
    } finally {
        if (s!=null){
            s.close();
        }
    }

}

The error that i am getting is

   java.lang.NumberFormatException error
   at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) 
   at sun.misc.FloatingDecimal.parseDouble(Unknown Source) 
   at java.lang.Double.parseDouble(Unknown Source) 
   at Payroll.loadStaffList(Payroll.java:128) 
   at PayrollRunner.main(PayrollRunner.java:45)
user207421
  • 305,947
  • 44
  • 307
  • 483

0 Answers0