How to Calculate Averages and Medians of Arrays