import java.util.*; import java.io.*; public class Temp { public static void main(String[] args) throws FileNotFoundException { // open the file (i.e. set up the Scanner) Scanner input = new Scanner(new File("temp.txt")); int num1 = 0; int num2 = 0; // check if there's a number if (input.hasNextInt()) { // read the number and store it num1 = input.nextInt(); } while (input.hasNextInt()) { // check if there's a number if (input.hasNextInt()) { // read another number and store it num2 = input.nextInt(); } // find the difference and print it System.out.println("Temperature changed by " + (num2 - num1) + " deg F"); num1 = num2; } } }