00001 // Statistics.hh 00002 00003 // Created by John Zweck, Feb 7th, 2003. 00004 // Adapted from the StatisticsOfArray class in OCS 00005 00017 00018 /* 00019 00020 Class definitions generally have the syntax 00021 00022 class MyClass 00023 { 00024 public: 00025 00026 MyClass(....); 00027 ~MyClass(); 00028 00029 // public methods go here 00030 00031 int MyPublicMethod(.......); 00032 00033 // public data (if any) goes here 00034 00035 double MyPublicData; 00036 00037 private: 00038 00039 // private methods (if any) go here 00040 00041 int MyPrivateMethod(.......); 00042 00043 // private data goes here 00044 00045 double MyPrivateData; 00046 00047 }; // Note the final ; !!!! 00048 00049 */ 00050 00051 00052 #ifndef _STATISTICS_HH 00053 #define _STATISTICS_HH 00054 00055 class Statistics 00056 { 00057 00058 // ### Public Methods ### 00059 00060 public: 00061 00063 00064 00104 Statistics(int arrayLengthIn, double *arrayIn); 00105 00106 00108 00127 ~Statistics(); 00128 00130 00131 double GetMinimum() {return minimum;}; 00132 double GetMaximum() {return maximum;}; 00133 double GetMean() {return mean;}; 00134 double GetStdDev() {return standardDeviation;}; 00135 double GetVariance() {return variance;}; 00136 double GetMedian() {return median;}; 00137 00138 // ### Private Methods ### 00139 00140 private: 00141 00143 00144 double Minimum(void); 00145 double Maximum(void); 00146 double Mean(void); 00147 double MeanSquares(void); 00148 double Variance(void); 00149 double Median(double * SortedArray, int Length); 00150 00152 00153 void SelectionSort(double * Array, double * SortedArray, int Length); 00154 00155 00157 00158 int MaximumIndex(double * Array, int Length); 00159 00160 // ### Private Data ### 00161 00162 private: 00163 00165 00166 int arrayLength; 00167 00170 00171 double * array; 00172 00174 00175 double * sortedArray; 00176 00178 00179 double minimum; 00180 double maximum; 00181 double mean,standardDeviation,variance; 00182 double median; 00183 00184 00185 }; // ## end of definition of class Statistics 00186 00187 00188 #endif /* _STATISTICS_HH */ 00189 00190