package inorder.without.cheats;
import java.util.Arrays; import javax.swing.JOptionPane;
public class InOrderWithOutCheats {
public static void main(String[] args) {
int howManyNumbers = Integer.parseInt
(JOptionPane.showInputDialog
(null, "how many numbers would you like to chose?"));
//gets number of numbers, stores number in "howManyNumbers"
if (howManyNumbers <= 0){JOptionPane.showMessageDialog
(null, "You Must Enter A Positive Number Greater "
+ "Than 0!", "Hey!", JOptionPane.ERROR_MESSAGE);
}
// prevents "howManyNumbers" from being <= 0
int[] array = new int[howManyNumbers];
int i = 1;
while (i <= howManyNumbers){
int choseNumber = Integer.parseInt
(JOptionPane.showInputDialog
(null, "Number #" + i));
i = i -1;
array[i] = choseNumber;
i = i + 2;
}
// assigns the chosen numbers to array "array"
int largest = array[0];
for(int z = 0; z < array.length; z++){
if(array[z] > largest){
largest = array[z];
}
}
// finds the largest number in "array" and puts it in "largest"
int[] array2 = new int[array.length];
for (int k = 0; k <= largest; k++){
for (int a = 0; a <= array.length; a++){
if (k == array[a]){
for (int b = 0; b < array.length; b++){
if (b == 0){
k = array2[b];
}
}
}
}
}
/*
* wrote this bit myself, it would be nice if it went through the array
* and re arranged them numerically into "array2"
*/
JOptionPane.showMessageDialog (null, Arrays.toString(array2));
/*
* and finnaly, this should give you the numbers you first entered,
* but in order from least to greatest.
*/
}
}