Question
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args) { ArrayList sorted = loadEmployee(NamesOfEmployees.csv); //
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Collections;
public class Main {
public static void main(String[] args) {
ArrayList
// created a shuffled version ArrayList
public static ArrayList
BufferedReader br = null; FileReader fr = null;
ArrayList
fr = new FileReader(filename); br = new BufferedReader(fr); String line; br = new BufferedReader(new FileReader(filename));
while ((line = br.readLine()) != null) { lines.add(line); }
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null) br.close();
if (fr != null) fr.close();
} catch (IOException ex) {
} int count = 0; for (int i = 0; i < lines.size(); i++) {
String field[] = lines.get(count++).split(",");
employees.add(new Employee(field[0], field[1], field[2], String.format("%010d", i), field[3])); count = count % lines.size();
}
}
return employees; }
}
public class Employee implements Comparable
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started