-- CSCI 51, Fall 98, Project 7 -- Compute Numerical Statistics Package
-- File = stats.ads
PACKAGE stats IS
TYPE sort_array IS ARRAY (1..100) of Float;
-- type definition of a one-dimensional array with 100 elements
PROCEDURE sort (in_array : IN sort_array;
out_array : OUT sort_array;
in_count : IN Natural);
-- pre: one-dimensional array (in_array) with up to 100 elements of float
-- number of elements in the array (in_count)
-- post: sorted one-dimensional array (out_array), ascending order
FUNCTION average (in_array : IN sort_array;
in_count : IN Natural) RETURN Float;
-- pre: one-dimensional array (in_array) with up to 100 elements of float
-- number of elements in the array (in_count)
-- post: return the average of the elements
FUNCTION median (in_array : IN sort_array;
in_count : IN Natural) RETURN Float;
-- pre: one-dimensional array (in_array) with up to 100 elements of float
-- whose elements are already sorted in ascending order
-- number of elements in the array (in_count)
-- post: return the median of the elements
FUNCTION mode (in_array : IN sort_array;
in_count : IN Natural) RETURN Float;
-- pre: one-dimensional array (in_array) with up to 100 elements of float
-- whose elements are already sorted in ascending order
-- number of elements in the array (in_count)
-- post: return the mode of the elements in an array
FUNCTION max (in_array : IN sort_array;
in_count : IN Natural) RETURN Float;
-- pre: one-dimensional array (in_array) with up to 100 elements of float
-- whose elements are already sorted in ascending order
-- number of elements in the array (in_count)
-- post: return the maximum valued element in the sorted array,
-- in_array(in_count)
FUNCTION min (in_array : IN sort_array;
in_count : IN Natural) RETURN Float;
-- pre: one-dimensional array (in_array) with up to 100 elements of float
-- whose elements are already sorted in ascending order
-- number of elements in the array (in_count)
-- post: return the minimum valued element of the sorted array,
-- in_array(1)
END stats;