// By Jessica Kent & Brad Downey

import javax.swing.JOptionPane;

public class lab23
{
  public static void sort(Comparable[] array)
  {
      Comparable temp;
      for (int b = array.length-1; b > 1; b--) {
          for (int a = 0; a < b; a++) {
              if (array[a].compareTo(array[a+1])> 0) {
                  temp = array[a+1];
                  array[a+1] = array[a];
                  array[a] = temp;
              }
          }
      }
  }

  public static void choose()
  {
      Object [] s = new Object[10];
      int choice = Integer.parseInt (JOptionPane.showInputDialog ("Which type of data do you want"+
             "in this array?\nType 1 for integers\nType 2 for strings."));
      if (choice == 1) {
          for (int a = 0; a < 10; a++) {
              Integer i = new Integer(Integer.parseInt (JOptionPane.showInputDialog("Give me a number...")));
              s[a] = i;
              }
          }
      if (choice == 2) {
          for (int a = 0; a < 10; a++) {
              s[a] = JOptionPane.showInputDialog("Give me a string...");
              }
          }
          sort((Comparable []) s);
      for (int a = 0; a < 10; a++){
          System.out.println("Your array contains: " + s[a]);
      }
  }
}