# The purpose of this assignment, is for students to demonstrate knowledge of ...

**Assignment 7**

This assignment is worth a maximum of 100 points

**Objective**

**The purpose of this assignment, is for students to demonstrate knowledge of the basic template of a simple C program create and use one dimensional arrays the design of user defined C functions calling user defined functions in C how solution to problems can be developed from a set a functions**

**Background Information:**

This assignment pertains to statistical analysis for a given data sample. In statistics, a collection of data values is usually referred to as a distribution. A primary purpose of statistical analysis is to find ways to compress the complete set of data into summary statistics,that express properties of the distribution as a whole.Mean:The most common statistical measure is the mean, which is simply the traditional average. For the distribution x1, x2, … xn, the mean is usually represented by the symbol x Standard Deviation:Another common statistical measure is the standard deviation, which provides an indication of how much the individual values in the distribution differ from the mean. To calculate the standard deviation whose elements are x1, x2, … xn you need to perform the following steps:a. Calculate the mean of the distribution.

b. Go through the individual data items in the distribution and calculate the square of the difference between each data value and the mean. Add all these values to a running total.c. Take the total from step b and divide it by the number of data items.

d. Calculate the square root of the resulting quantity, which represents the standard deviation.In mathematical form, the standard deviation () is given by the following formula: = nx xnii

12Histogram:

A histogram gives us a pictorial view of the data. Basically it is a frequency plot. For example given a histogram of a set of scores of students in a class, we can immediately see whether there were more students in the range 50-54 or 80-84 and so on. To draw a histogram, first decide upon the intervals. Let us say the interval is 5. Then count the number of students getting marks in the intervals 0-4, 5-9, 10-14, 15-19, 20-24, 25-29 and so on. The last interval will contain a single integer. Now you are ready to draw the histogram or the frequency plot. Here is an example of a histogram plot:0– 4|****************5- 9|***********************10-14|******************************15-19|*************************************20-24|**********************25-29|*************30-34|*********35-39|****40-44|**45-49|*50|**

Functions of the math.h library The sqrt function in the math.h library computes the square root of a double and returns the answer as a double. For example sqrt (4.0) will return 2.0. The pow function in the math library takes 2 doubles x and y, and returns a double that is equal to x raised to the power of y. For example pow(2.0, 3.0) returns 8.0. Description of the Assignment Problem: Your program should read in a set of positive integer grades from an input file called input.txt. Each grade will be on a separate line. The end of the list of grades is marked by the number -999. Do NOT process this value. You can assume that there will be at least three grades and not more than 100 grades in the file. Also, all of the grades will be integers from 1 to 100, inclusive. Your program should: Store the set of grade data read from the file Then it should compute the minimum value in the data, print this out to two decimal places and remove it from the data Then your program should compute the maximum value, print it out to two decimal places and remove it from the data. Your program should calculate the mean and standard deviation for the remaining set of grades, and print these out to two decimal places Finally, a histogram for this data (without the highest and lowest grades) should be printed out as well.Your program should include the following functions:A function called read Grades that takes an array of doubles called grades for which all of the values have been initialized to 0. This function returns an integer.This function reads an input file to obtain an unknown number of grades (at most 100). These grades are stored into the array called grades; The function also counts the data items that have been read. The end of the input is represented by a negative number -999. Your function should return the number of grades read.A void function frequency which takes a double array of grades and the number of grades stored in the array. This function finds out the frequency (number of students) for each interval 0-4, 5-9,…..,95 – 99, 100 prints out the frequency values as the plotted histogram as shown in the histogram section above.A function maximum which takes the array of grades and the number of grades and returns the location of the highest number in the array A function minimum which takes the array of grades and the number of grades and returns the location of the lowest number in the array A function called delete Element that takes the array of grades, the number of grades and the location of the element to be deleted. It returns the updated number of elements in the array.A function called mean, that takes the array of grades and the number of grades. It returns the mean of the set of grades as a double.A function called standard Deviation that takes the array of grades, the number of grades and returns the standard deviation of the set of grades. The return value is a double. The standard deviation is computed as described in the previous section. Restrictions Your program should include math.h system library to use sqrt () and pow() functions.

Each function should have a comment statement in the beginning to indicate the inputs that it takes and the output it delivers.Although all of the grade values are integers, however, they should be stored in an array of doubles. You do not have to worry about making the values doubles. Your declaration of the array will take care of this.

You'll get 1 file (421.1KB)