I'm trying to figure this out: I'm asked to find the sum of the temperatures, but first i have to get them into an array list. My code so far:
    public static void main(String[] args) {
    String fileName = "weather.txt";
    File file = new File(fileName);
    Scanner scanner = null;
    try {
        scanner = new Scanner(file); 
    } catch (FileNotFoundException e) {
        System.out.println("The File can't be found!");
        return;
    }
    ArrayList<String> weather = new ArrayList<String>();
    while (scanner.hasNextLine()) {
        String line = scanner.nextLine();
        String[] splittedString = line.split("|");
        String[] split = line.split("\\|");
        System.out.print("{");
        System.out.print("\"Tempreture\" = " + splittedString[0]);
        System.out.print(", \"Humidity\" = " + splittedString[1]);
        String[] date = split[2].split("/");
        System.out.print(", \"Day = " + date[0]);
        System.out.print(", \"Month\" = " + date[1]);
        System.out.print(", \"Year\" = " + date[2]);
        System.out.print("}");
        System.out.println("\n");
        weather.add(splittedString[0]);
        for (int i = 1; i < splittedString.length; i++) {
            System.out.print(splittedString[i]);
        }
        weather.add(splittedString[0]);
        for (int i = 0; i < splittedString.length; i++) {
            System.out.print(splittedString[i]);
        }
I couldn't find the proper way to get the temperature data, convert to double and find the sum.
The data from txt is:
11.4|12|5/1/1995
13.0|10|6/1/1995
13.5|11|7/1/1995
11.2|11|8/1/1995
14.6|11|9/1/1995
 
     
     
     
     
     
    