/** * INPUT: Two integers using two separate pop-up windows * OUTPUT: Their average. * */ import javax.swing.JOptionPane; class AverageOfTwoIntegers{ public static void main(String [] args){ String input = JOptionPane.showInputDialog("Enter first integer"); // declare a variable called sum and initialize it to the first integer int num1 = Integer.parseInt(input); // Variable input has alread been declared.Can reuse it. input = JOptionPane.showInputDialog("Enter second integer"); int num2 = Integer.parseInt(input); int sum = num1 + num2; double average = sum / 2.0; System.out.println("The average is " + average); System.exit(0); } }