/home/caleb/ASDV-Java/Semester 2/Assignments/MP5_CalebFontenot/src/main/java/com/calebfontenot/mp5_calebfontenot/Large.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.calebfontenot.mp5_calebfontenot;
import java.io.File;
import java.util.ArrayList;
import java.util.Scanner;
public class Large {
public static void main(String[] args) {
ArrayList firstNameArr = new ArrayList();
ArrayList lastNameArr = new ArrayList();
ArrayList jobTitleArr = new ArrayList();
ArrayList salaryArr = new ArrayList();
File file = new File("Salary.txt");
try (Scanner fileScanner = new Scanner(file)) {
while (fileScanner.hasNext()) {
firstNameArr.add(fileScanner.next());
lastNameArr.add(fileScanner.next());
jobTitleArr.add(fileScanner.next());
salaryArr.add(fileScanner.next());
fileScanner.nextLine();
}
} catch (Exception ex) {
System.out.println("Unable to read file");
}
for (int i = 0; i < firstNameArr.size(); ++i) {
System.out.println("first name :" + firstNameArr.get(i));
System.out.println("last name: " + lastNameArr.get(i));
System.out.println("job title: " + jobTitleArr.get(i));
System.out.println("salary: " + salaryArr.get(i));
System.out.println("--------------------------------------");
}
}
}