Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class manufactureArray {
- /**
- * @param args
- */
- public static void main(String[] args) {
- Scanner input= null;
- try {
- input = new Scanner(new File("ManufacturersSurveySmallest.txt"));
- } catch (FileNotFoundException e) {
- System.err.println("ERROR - File not found");
- System.exit(1);
- }
- int count=0;
- while (input.hasNextLine()) {
- String text = input.nextLine();
- count ++;
- String [] state= new String [count];
- String [] geoCode= new String [count];
- String []manuArea= new String [count];
- long [] workWages= new long [count];
- long [] workHours= new long [count];
- parser(text, count, state, geoCode, manuArea);
- }
- System.out.println(count+ " records");
- }
- public static void parser (String text, int count, String[] state, String [] geoCode, String manuArea[]){
- Scanner lineScanner = new Scanner (text);
- lineScanner.useDelimiter(":");
- for (int i=1; i<=count; i++){
- String myState=lineScanner.next();
- state[i]= myState;
- String geoCodeInput= lineScanner.next();
- geoCode[i]=geoCodeInput;
- String manuAreaInput= lineScanner.next();
- manuArea[i]= manuAreaInput;
- }
- System.out.printf(state[0], geoCode[0]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement