I have to produce a program that can read a file I have been given. The file contains 365 lines of data that is supposed to resemble temperature values. The first value on each line is the low temp, and the second is the high temp. From these values, I have to determine the number of days, the lowest of the low temps, highest of the max temps, and then the average of the lows and the average of the highs.
Here is what I have so far. The problem I am having is splitting the two values on each line to deal with them individually so I can turn them into a double so I can do computations on them
import TextIO.*;
public class Temperature {
public static void main(String[] args) {
TextIO.readFile("temperatures.dat");
//double salesTotal; // Total of all sales figures seen so far.
int dayCount, string1, a;
double tempTotal=0;
String dataString; // Number of cities for which data is missing.
dayCount = 0;
while ( ! TextIO.eof() ) { // process one line of data.
dayCount++;
dataString = TextIO.getln(); // Get the rest of the line.
a = dataString.indexOf(" ");
TextIO.put("\n" + a);
}
TextIO.put(dayCount);
}
}