Mp5 work
This commit is contained in:
1000
Semester 2/Assignments/MP5_CalebFontenot/Salary.txt
Normal file
1000
Semester 2/Assignments/MP5_CalebFontenot/Salary.txt
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Semester 2/Assignments/MP5_CalebFontenot/mp5-1-1.pdf
Normal file
BIN
Semester 2/Assignments/MP5_CalebFontenot/mp5-1-1.pdf
Normal file
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.mp5_calebfontenot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Large {
|
||||
public static void main(String[] args) {
|
||||
// Read data file
|
||||
// ArrayLists
|
||||
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(); // consume newline
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user