# Lab Day

Tom Kelliher, CS17

May 6, 1996

We'll skip 2-D arrays.

As promised, sample input data:

```100
75
100
80
75
100
70
-1
85
55
60
85
110
70
75
85
```

Example output:

```File name: grades.in

As: 3
Bs: 4
Cs: 5
Ds: 1
Fs: 1
Standard deviation: 13.5573

```

Suggested list of functions:

1. `int getInputs(int data[], int size);` --- Discussed previously. Reject any grades less than 0 or greater than 100.
2. `void putOutputs(int data[], int size);` --- Discussed previously.
3. `void sort(int list[], int size);` --- Discussed previously.
4. `void swap(int& a, int& b);` --- Discussed previously.
5. `int getMax(int data[], int size);` --- Work on this yourself.
6. `double getAverage(int data[], int size);` --- Work on this yourself.
7. `double getMedian(int data[], int size);` --- Assume data is sorted. Two cases:
1. size is even: Return average of middle two elements.
2. Otherwise: Return middle element.
8. `void getHistogram(int data[], int size, int& numAs, int& numBs,`
` int& numCs, int& numDs, int& numFs);` --- Notes:
• Set the five counts to 0.
• Use a switch statement containing five case labels and a default case to increment the count appropriate to the current grade.
• The switch expression will use integer division to convert the grade to a case label value.
9. `double getStdev(int data[], int size);` --- Notes:
• Calls getAverage() and keeps in a local variable.
• Sets sum to 0.0.