# sort and get median help

Duc Nguy

Greenhorn

Posts: 7

posted 14 years ago

I created a java program that deals with array but i got stuck on sorting the number in the array and getting the median from the sort can some help me out on this one.

import sort;

public class Random

{

public static void main (String[] args)

{

double total = 0;

double average = 0;

double[] number = new double[25];

for(int i = 0; i < 25; i++)

{

number[i] = (Math.random()*100+1);

total +=number[i];

}

average = total/25;

System.out.println("Average number in array: " + average);

{

Sorts.selectionSort (number[i]);

for (int index = 0; index < grades.length; index++)

System.out.println (number[i] + " ");

}

}

}

import sort;

public class Random

{

public static void main (String[] args)

{

double total = 0;

double average = 0;

double[] number = new double[25];

for(int i = 0; i < 25; i++)

{

number[i] = (Math.random()*100+1);

total +=number[i];

}

average = total/25;

System.out.println("Average number in array: " + average);

{

Sorts.selectionSort (number[i]);

for (int index = 0; index < grades.length; index++)

System.out.println (number[i] + " ");

}

}

}