CSS 502 - Winter 2013

Here are the scores. They are listed using the hash function found at the end.
For privacy, the list is padded with fake grades, but the averages are accurate.

Your average was computed as
    courseAvg = 0.35*ProgAv + 0.30*exam + 0.35*final

      exam  p1 prob p2 desg p3 prAvg final finalAvg
  MAX: 100  30   5  30  30  50 100    100  100
 2      92  29   5  27  28  49  95.2   83   89.96
 3      94  28   5  28  23  48  91.0   91   91.91
 4      78  26   5  28  27  49  93.1   89   87.14
 5      82  25   5  23  28  32  77.9   88   82.68
 7      73  21   5  24  29  35  78.6   81   77.77
 8      75  27   5  28  29  41  89.7   84   83.28
 9      82  26   5  28  27  35  83.4   84   83.21
10      88  26   4  27  28  48  91.7   90   90.00
11      71  27   4  26  27  30  78.6   85   78.57
12      83  25   3  24  28  45  86.2   93   87.62
14      90  28   5  28  28  43  91.0   93   91.41
15      64  27   4  28  27  48  92.4   78   78.84
16      68  21   1  24  28  37  76.6   74   73.09
18      95  27   4  24  28  43  86.9   93   91.46
19      88  26   5  28  23  40  84.1   77   82.80
20      88  27   5  27  29  40  88.3   85   87.05
21      84  25   4  29  27  35  82.8   91   86.02
24      78  28   5  27  23  48  90.3   84   84.42
25      81  24   5  27  27  47  89.7   88   86.48
26      70  28   5  27  28  35  84.8   87   81.14
27      85  24   5  29  29  48  93.1   87   88.54
29      85  27   5  27  24  43  86.9   79   83.56
30      76  21   5  18  23  25  63.4   85   74.76
31      74  20   5  27  28  48  88.3   91   84.95
32      84  25   3  23  24  42  80.7   84   82.84
37      91  28   5  28  27  46  92.4   92   91.84
38      78  28   5  28  27  47  93.1   90   87.49
41      96  29   5  28  28  48  95.2   89   93.26
42      90  25   5  22  29  32  77.9   86   84.38
43      78  24   4  22  28  42  82.8   86   82.47
44      84  28   4  28  27  35  84.1   90   86.15
45      74  21   5  27  24  35  77.2   82   77.93
46      48  20   3   0  21   0  30.3   87   55.47
47      95  30   5  27  28  46  93.8   97   95.28
51      93  28   4  28  29  48  94.5   95   94.22
52      68  20   3   0  22   0  31.0   89   62.41
53      65  20   3  20  22  25  62.1   79   68.87
54      40  29   3  26  27  40  86.2   52   60.37
55      85  28   4  28  28  47  93.1   81   86.44
56      95  28   4  28  29  48  94.5   91   93.42
57      72  29   5  28  23  49  92.4   81   82.29

Avgs:   78.9                           82.3


#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

const int IDLENGTH = 7;

int main() {
   string name;                        // student first name
   char id[7];                         // student ID number
   int index = 0, i;

   //                    a b c d e f g h i j k l m n o p q r s t u v w x y z
   int collision[26] = {20,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,5,0,7,3,0,0,0,5,0};

   cout << "Enter 7-digit ID number:  ";
   for (int i = 0; i < IDLENGTH; i++) cin >> id[i];

   cout << "Enter full first name (lowercase):  ";  cin >> name;

   // loop from 0 --> min(length of first name, 7) adding digits of id
   for (i=0; i < (name.length() < IDLENGTH ? name.length():IDLENGTH); i++) {
      index += id[i] - '0';
   }

   // resolve collisions using the second letter of name
   index += collision[name[1]-'a'];               

   cout << id << ' ' << name << "  hash code:" << setw(3) << index << endl;

   return 0;
}

