ECE 231 – Fall 2009

Programming Assignment 3

 

Due: Wednesday, September 16, 2009 at 11:59 PM

The number of millions of gallons of sewage that are disposed of each day for a major city is measured continuously for one month.  The data will be saved in a file called sewage.txt.  The data will be stored as integers in one column unordered.  The maximum number of data could be 31 and the least 28.  You will need to create an array for storing this data.

 

You need to perform the following on the data using a separate function for each one:

 

-        Populate the array with data from the file (using an eof() for the loop) – you will need to count how many days of data are in the file.

-        Sort the array of numbers in ascending order.

-        Find the maximum, minimum, mean and median values.

-        Calculate the frequency of occurrence in the ranges of 0-50, 51-80, 81-90, 91-100, 101-110, 111-120, 121-150, and 151 and above and print each frequency.

 

Your main() program should print the original data in the same order as the data file, print the sorted data, print the maximum, minimum, mean and median values.

 

You will need multiple for() loops for the array and need to pass by value (the number of days or elements in the array) and pass by address (the array address).