// Miya Natsuhara // 07-29-2019 // CSE142 // TA: Grace Hopper // Prints out the change in temperature between days given by data stored in a file. Ignores // tokens that are not real numbers. import java.util.*; import java.io.*; public class Weather { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("weather.txt")); // fencepost! (We're reading in n numbers, but have only (n-1) differences between pairs! double temp1 = input.nextDouble(); while (input.hasNextDouble()) { double temp2 = input.nextDouble(); System.out.println("temp1: " + temp1 + ", temp2: " + temp2 + ", difference: " + (temp2 - temp1)); temp1 = temp2; } } }