import java.util.Scanner;
import javax.swing.JOptionPane;
/*
 * ConfirmDialogExample.java
 *
 * Created on June 2, 2006, 1:59 PM
 *
 * COP 2210 Programming I
 * Examples
 */

/**
 *
 * @author Bill Kraynek
 */
public class ConfirmDialogExample {
        
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int sum = 0;
        String out = "";
        while( true ) {
            int input = JOptionPane.showConfirmDialog(null,"Do you want to quit?");
            if( input == JOptionPane.YES_OPTION ) break;
            if( input == JOptionPane.NO_OPTION ) {
                String numberString = JOptionPane.showInputDialog("Enter a number");
                out += numberString + "\n";
                Scanner scan = new Scanner(numberString);
                sum += scan.nextInt();
            }// end if
        }// end while
        JOptionPane.showMessageDialog(null,"The sum of \n" + out + " = \n" + sum);
    }
    
}

