
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import javax.swing.JOptionPane;


/**
 * COP2210 Example
 * @author Bill Kraynek
 */
public class ClassExampleFour {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
        String line = JOptionPane.showInputDialog("Enter a line", "Here  is a new  line  ");
        if( line == null ) return;
        Scanner scanner = new Scanner(line);
        ArrayList<String> words = new ArrayList<String>();
        while (true) {
            if (!scanner.hasNext()) break;
            String word = scanner.next();
            words.add(word);
        }// end while
        Collections.sort(words);
        JOptionPane.showMessageDialog(null,words);
        String out = "Words in order\n\n";
        for( String aWord : words ) {
            out += aWord + "\n";
        }// end for
        JOptionPane.showMessageDialog(null,out);
        ArrayList<Double> numbers = new ArrayList<Double>();
        numbers.add(37.37);
        numbers.add(23.0);
        numbers.add(100.99);
        numbers.add(27.0);
        numbers.add(23.0); 
        Collections.sort(numbers);
        double min = numbers.get(0);
        double max = numbers.get(numbers.size()-1);
        JOptionPane.showMessageDialog(null,"Smallest number is " + min + "\nLargest number os " + max);
        out = "Numbers is order are:\n\n";
        for( double number : numbers ) {
            out += number + "\n";
        }// end for
        JOptionPane.showMessageDialog(null,out);
        Scanner fileScan = new Scanner(new File("src/ClassExampleFour.java"));
        fileScan.useDelimiter("[^a-zA-Z]+");
        while( fileScan.hasNext() ) {
            System.out.println(fileScan.next());
        }// end while
    }

}

