Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Andrew Cz
Added: Nov 29, 2018 3:09 PM
Modified: Nov 29, 2018 3:28 PM
Views: 1
Tags: no tags
in FileIO splits the elements in the line by regex (;) and counts the instances
  1. public static int printGoodWeatherCrashes() {
  2.         List<String> lines = readFile();
  3.         String[] splitLines;
  4.         int sum = 0;
  5.         for (String line : lines) {
  6.             splitLines = line.split(";");
  7.             if (splitLines[5].equals("CLOUDY") || splitLines[5].equals("CLEAR")) {
  8.                 sum++;
  9.             }
  10.         }
  11.  
  12.         return sum;
  13.     }