Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.37 KB | None | 0 0
  1. /**
  2.  *
  3.  */
  4. package Assignment1;
  5.  
  6. import javafx.application.Application;
  7. import javafx.stage.Stage;
  8. import java.io.BufferedReader;
  9. import java.io.FileNotFoundException;
  10. import java.io.FileReader;
  11. import java.io.FileWriter;
  12. import java.io.IOException;
  13. import java.lang.reflect.InvocationTargetException;
  14. import java.util.StringTokenizer;
  15. import java.math.BigInteger;
  16. import com.opencsv.CSVReader;
  17. /**
  18.  * @author mike
  19.  *
  20.  */
  21. @SuppressWarnings({"restriction", "unused"})
  22. public class Dashboard extends Application {
  23.  
  24.     /* (non-Javadoc)
  25.      * @see javafx.application.Application#start(javafx.stage.Stage)
  26.      */
  27.    
  28.     private static String csvFile = "C:\\Users\\mike\\workspace\\Fall16-Lab1-BIDA\\src\\Assignment1\\property_tax_report.csv";
  29.     private static String[] cols;
  30.     private static String[] columnInformation;
  31.     private static int lineNumber = 1;
  32.     private static int tokenNumber = 0;
  33.     private static int totalLenght = 0;
  34.     private static BigInteger number;
  35.     private static BigInteger calculatedNumber;
  36.     private static BufferedReader reader;
  37.     private static String strLine;
  38.     private static StringTokenizer st = null;
  39.  
  40.     public static void getPropertyTax() throws IOException{
  41.         try{
  42.             reader = new BufferedReader(new FileReader(csvFile));
  43.            
  44.         }catch(FileNotFoundException exception){
  45.             System.out.println(exception);
  46.         }
  47.        
  48.         while ((strLine = reader.readLine()) != null){
  49.             lineNumber++;
  50.             cols = strLine.split(",");
  51.             System.out.println("column 26 = " + cols[26]);//+ " , Column 27 = " + cols[27]);
  52.             System.out.println("This has ran  " + lineNumber + " times");
  53.             if (cols[26] == "TAX_LEVY"){
  54.                 System.out.println("This is a string");
  55.             }else{
  56.                 System.out.println("This row is " + lineNumber);
  57.                 System.out.println(cols[26]);
  58.                 columnInformation[0] = cols[26];
  59.            }
  60.         }
  61.        
  62.         for (int i = 0; i <= columnInformation.length; i++){
  63.             number = new BigInteger(cols[26]);// BigInteger(cols[26]);
  64.             calculatedNumber.add(number);
  65.             totalLenght++;
  66.         }
  67.         calculatedNumber.divide(BigInteger.valueOf(totalLenght));
  68.         System.out.println(calculatedNumber);
  69.     }
  70.     @Override
  71.     public void start(Stage primaryStage) throws Exception {
  72.    
  73.        
  74.        
  75.        
  76.        
  77.        
  78.     }
  79.    
  80.     public static void main(String args[]) throws IOException{
  81.     //  launch(args);
  82.         getPropertyTax();
  83.     }
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement