Question
Asked by:
$10.00 Basic Integer Statistics Project
- From Computer-Science: Algorithms , Computer-Science: General-CS
- Closed, but you can still post tutorials
- Due on Apr. 20, 2008
- Asked on Apr 19, 2008 at 1:41:47PM
Q:Project Summary
Code a C++ console application (stats.cpp) that includes the following "statistical" functions. Each of these methods accepts an int array as an input parameter and calculates a specific statistical value. The input parameter "int n" is used to pass the number of elements in the array that you should use in your calculations.
int Maximum( int ar[], int n)
{
// returns the maximum element value in the array "ar"
}
int Minimum(int ar[], int n)
{
// returns the minimum element value in the array "ar"
}
float Mean(int ar[], int n)
{
// returns the mean value for the array ar"
}
float Median(int ar[], int n)
{
// returns the median value for the array "ar"
}
float StandardDeviation( int ar[], int n)
{
// returns the standard deviation for the array "ar" (use formula below)
}
The main function
Your main function is used to call your statistical functions. It is up to you to generate some test data and check to make sure your methods work correctly. You do not have to provide code in your main() function when you turn in this project. The code for you main() function will be provided by the grading program.
Processing
The processing for each function is yours to figure out, however your functions should be able to handle an input array consisting of any number of (int) elements.
Grading
When grading, I will supply code for your main function. It will call each of the statistical methods listed above and check to see that the returned value from each method is correct. You must implement each of the methods listed above.
Hints and Helps
Median
For an odd number of elements the median is the middle element. Example array (1,2,3,4,5) median=3
For an even number of elements the median in the average of the 2 middle elements. Example array (1,2,3,4) median = 2.5
Use the attached Formula for Standard Deviation
Where x is an individual array value, x-bar is the mean and n is the number of values in the array. There are other formulas for standard deviation -- use this formula.
Example Test Data (you can make up similar sets of integer test data)
10
3
57
8
3
9
23
43
56
78
89
I am willing to pay more than $10 via PaypalAttachments:standard deviation equation.JPG (5K)



