Code /* IOapalooza2.java CIS 260 David Klick 2006-01-18 This program demonstrates simple console I/O using a Scanner and a PrintStream. It also demonstrates a simple input loop and basic data validation. */ import java.util.Scanner; import java.util.InputMismatchException; public class IOapalooza2 { public static void main(String[] args) { Scanner kbd = new Scanner(System.in); int sum = 0; while (true) { System.out.print("Enter an integer (QUIT to exit): "); try { int num = kbd.nextInt(); sum += num; } catch (InputMismatchException e) { if (kbd.nextLine().equalsIgnoreCase("QUIT")) break; System.out.println("Illegal integer"); } } System.out.println("The total is " + sum); } }