// Helene Martin, CSE 142 // Reads temperatures from a file and calculates the difference between each pair import java.io.*; // for File import java.util.*; // for Scanner public class Weather { public static void main(String[] args) throws FileNotFoundException { Scanner s = new Scanner(new File("weather.txt")); double temp1 = s.nextDouble(); while (s.hasNext()) { if (s.hasNextDouble()) { double temp2 = s.nextDouble(); double diff = temp2 - temp1; System.out.println(temp1 + " to " + temp2 + ", change = " + diff); temp1 = temp2; } else { s.next(); } } } }