使用C++实现 Statistics 的几种公式,需要用到OOP的设计思路。
Project Description
Create a Visual Studio C17 console application to compile the following
statistics on a list of real numbers:
For the following formulae is the datum, is the dataset, where ( is an element
of ).
Metric | Formula |
---|---|
Number of values | The count of the elements in the dataset. |
Minimum value | The value that is less than or equal to all values in the |
set. | |
Maximum value | The value that is greater than or equal to all values in the |
set. | |
Range | The range of values of the dataset. |
Statistical median | The middle value of a sorted data set of odd length, or |
the arithmetic mean of the two closest values to the middle of a sorted data | |
set of even length. | |
Arithmetic mean | The sum of all the values divided by the number of values. |
Variance | The mean of the squared differences of each sample from the |
arithmetic mean. | |
Standard deviation | The square root of the variance. |
Frequency table | A table listing the interval, and the count of data set |
values in that interval, and the percentage of the dataset represented by | |
count of that interval. | |
Quintiles population means | A quintile is a grouping of the sorted data by |
fifths (first 20%, second 20%, etc.) The quintile population mean is the | |
population mean of one quintile of the data set. | |
Outliers | Report the number of outliers for both two and three standard |
deviations from the mean. Count high and low outlier separately. | |
Your program must handle any length of list (potentially billions!) The list | |
will be input (or piped) from the console, or read from a file. The list is | |
terminated with end-of-stream (^Z, or ^D on Linux) or the word end. Bad input | |
is to be skipped. Sample input lists are posted on FOL. | |
Keep the output clean and minimal. A sample output file is posted on FOL. | |
You will have to sort the data to compute the median and are to implement your | |
own sort. Your grade is dependent upon the sorting algorithm that you choose | |
(to get full marks, implement the quick, merge sort or heap sort). Sorting | |
algorithms can be found at GATS Companion to Searching and Sorting. | |
A sample of the executable, input file format and output file format are | |
posted on FOL. Your output should be formatted as the output file. All | |
statistics numbers calculated should be displayed to 3 decimal places, where | |
applicable. You should create more input files to verify that all your | |
statistics are done properly. |
Grading Criteria
Input Requirements
- Reads double precision real numbers
- Terminates input on EOF
- Doesn’t handle any size data set (array is NOT heap allocated)
- Skips bad inputs (only terminates on ‘end’ or EOF)
- Input from keyboard
- Input from file named on command line
- Reports bad filename
Statistics Requirements
- Number of values reported
- Minimum value correctly reported in all cases
- Maximum value correctly reported in all cases
- Range value correctly reported in all cases
- Mean correctly reported in all cases
- Median correctly reported in all cases
- Population variance correctly reported in all cases
- Population standard deviation correctly reported in all cases
Frequency Table Requirements (must complete statistics first)
- Group labels
- Minimum and Maximum ranges
- Count is displayed and correct
- Percentage is displayed and correct
Quintile Requirements
- Group labels
- Quintile population means are correct.
- Reported range is correct
- means column width adjust dynamically
Outlier Requirements
- Output is clearly formated
- counts are correct (3x, 2x / low, high)
- Reports “no outlier” when appropriate
Non-functional requirements
- Sort is: bubble
- Sort is: insertion sort
- Sort is: qsort
- Sort is: quick/merge/heap
- Sort is: Bogo/Bozo
- Labels are not left justified
- Values are not right justified
- Values are not rounded to 3 decimal places
- Frequency table code is contained in a function
- Multi-file solution
Penalties
- Penalties from C & C++ Grading Guide v2.3.0
- Late submission
Submission Requirements
- Submit entire Visual Studio project directory to Fanshawe Online
* a. Delete all debug and release directories.
* b. Submit in a .ZIP, .7z archive file.