Advertisement
Guest User

Untitled

a guest
Apr 13th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1.         import java.io.File;
  2.         import java.io.FileNotFoundException;
  3. import java.util.Scanner;
  4. public class manufactureArray {
  5.  
  6.     /**
  7.      * @param args
  8.      */
  9.     public static void main(String[] args) {
  10.         Scanner input= null;
  11.        
  12.         try {
  13.          input = new Scanner(new File("ManufacturersSurveySmallest.txt"));
  14.         } catch (FileNotFoundException e) {
  15.             System.err.println("ERROR - File not found");
  16.             System.exit(1);
  17.            
  18.         }        
  19.         int count=0;
  20.         while (input.hasNextLine()) {
  21.             String text = input.nextLine();
  22.             count ++;
  23.         parser(text, count);   
  24.        
  25.         }
  26.         System.out.println(count+ " records");
  27.         }
  28.     public static void parser (String text, int count){
  29.         String [] state= new String [count];
  30.         String [] geoCode= new String [count];
  31.         String []manuArea= new String [count];
  32.         long []  workWages= new long [count];
  33.         long [] workHours= new long [count];
  34.            
  35.     Scanner lineScanner = new Scanner (text);
  36.     lineScanner.useDelimiter(":");
  37.     for (int i=1; i<=count; i++){
  38.         state [i]= lineScanner.next();
  39.         geoCode [i]= lineScanner.next();
  40.         manuArea [i]= lineScanner.next();
  41.         workWages [i]= lineScanner.nextLong();
  42.         workHours [i]= lineScanner.nextLong();
  43.        
  44.     }
  45.     System.out.println(state[1]);
  46.            
  47.     }
  48.     //public static void hourlyWages(long []workWages, long [] workHours){
  49.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement