IUP Computer Science
COSC 110     Fall 06

Project #5
(Comparing Classes)
(Due 17 November 2006)

The students in two sections of COSC 310 recently took an exam.  Their names and scores are recorded in separate files:  cosc310-01.txt   and   cosc310-02.txt  For each file, the information is in the following form:

Score  LastName, FirstName

Scores range from 0 to 100 and there is a comma and a space between the last name and the first name.  The students are listed in each file so that the highest score is first and the lowest score is last, i.e., in descending order based on their scores.  Both files can be found on the I: drive in I:\jlwolfe\110

You are to write a program that compares the two sections statistically.  For each section, the program must calculate the mean (average) score, the median (middle) score, and the mode (most frequent) score.  The mean is calculated at the sum of the scores divided by the number of scores.  The median is determined by examining the scores in sorted order and either identifying the middle score as the median (when there are an odd number of scores) or calculating a median as the average of the two scores nearest the middle (when there are an even number of scores).  The mode is the score which has occurred most frequently.  If two or more scores are tied as being the most frequent, your program should report the highest one.

After displaying the statistics, the program must display the names and scores for students from each section that scored 90 or above.

Requirements:
 

  1. Your program must  use arrays to process the scores and names and calculate the statistics.

  2.  
  3. Your program is permitted to read the files once each.

  4.  
  5. Your program must use functions to calculate the mean, median, and mode.  In addition, I would recommend using a function to read the file contents into arrays.  The functions may be either void or value returning, your choice.

  6.  
  7. Your program must produce output that has the following form.  Notice the formatting of the Mean and Median and the way in which the names are displayed (First name Last name with no comma).  The Number is how many students there are in each section.  The 'x's should be replaced with appropriate values determined by the functions.  A value such as xx.xx indicates that there will be two digits on each side of the decimal point.

      Comparison of sections 1 and 2 of COSC 310
              Section 1    Section 2
    Number           xx           xx
    Mean          xx.xx        xx.xx
    Median         xx.x         xx.x
    Mode             xx           xx

    Students with scores 90 or above in Section 1
    Grimm Goose              94
    Dick Tracy               91
    Broom Hilda              90

    Students with scores 90 or above in Section 2
    Joe Btfsplk              99
    Sadie Hawkins            96
    Elmo Tuttle              95
    Rex Morgan               91
 

Extra Credit:

If you want extra credit on this project, you should add a function that calculates the standard deviation for each section and display it after the mode.  The standard deviation is the square root of the sum of the differences between each score and the mean squared and divided by the number of scores.

       In the formula, N is the number of scores.  If you do the standard deviation, its value should be displayed on the line below where the mode is displayed and have two decimal places; naturally, it should be appropriately labeled.

You can also get extra credit if you make the input from the files a function (which you use twice) and make the display of the students with scores in the 90's a function (which you use twice).

Hand in a well documented printout of your program and a printout of the program output, captured from the output window.  Also, copy your .cpp file to the handin folder on the P: drive.  Be sure it is named after yourself, such as  wolfe-p5.cpp