Hey

The task is to read in a file containing N doubles (readings from an experiment), then compute the average A1 of all values.
After that, calculate the average A2 of all values excluding the furthest value away from A1.
After that, calculate the average A3 of all values excluding the furthest and second furthest value away from from A2.
...
After that, calculate the average AN of all values excluding the (N-1) furthest away values from A(N-1).
As far as I understood the task, it is okay to disregard special cases like a double appearing several times in the list, or several doubles in the list being equally far away from the last calculated average value.
Here's my take on it, it works for my simple testing file containing 3 8 9 0. I feel my code is overly complicated, is there a better/simpler solution without using array methods (my course did not introduce these yet)?
This post was edited by tt_toby on May 4 2013 02:53pm