Homework Assignment #3 (due: 11/18/08 at 6p.m.)

CS 348 Waterloo, Fall '08


Notes (please read carefully):

  1. All applications must work with the the class-marks database introduced in Assignment 2:
        STUDENT(SIN integer, NAME char(20), EMAIL char(40))
        ASSIGNMENT(TID char(4), DESCRIPTION char(30), 
                   MAXGRADE integer, VALUE float)
        GRADE(SIN integer, TID char(4), GRADE integer)
    
    Attributes SIN and TID do not contain NULLs and are unique. Moreover, for every GRADE you are guaranteed there is an appropriate STUDENT and ASSIGNMENT.
  2. For simplicity, the distinction between assignments, exams, etc. is determined by the value of the DESCRIPTION attribute; it will contain the strings "Midterm" and "Final" for the midterm and final examinations, respectively.
  3. All applications must be developed using Embedded SQL and C.
  4. You may (and probably want to) use the util.{c,h} files available here.
  5. The completed assignment must cleanly compile using the Makefile provided here.
  6. Submit the final version of your solutions using submit.
  7. You may again need a copy of the database; as in Assignment 2, use this file to create the tables.


Application:

Write an application using Static Embedded SQL that:
  1. given a student id (SIN), assignment id (TID), and grade assigns this grade to the student for a given assignment. The program should notify the user whether the grade was a new grade or a modification of an existing grade for that assignment. For example:
    rees$ app 12345 FE 60
    Student John Smith (12345): new grade for Final (FE) is 60
    rees$ app 12345 FE 80
    Student John Smith (12345): changed grade for Final (FE) from 60 to 80
    
  2. given a student id (SIN) alone, the application should print out the corresponding student name and then, for each assignment, the grade the student obtained out of the maximal grade possible and its contribution to the final grade for the class. Assignments that have not been submitted should be omitted from the output. For Example:
    rees$ app 12345
    Student John Smith (12345):
      ER Diagrams (A1)         10/20    2.50%
      SQL (A2)                 75/100   3.75%
      Final(FE)                80/100  36.00% 
    
  3. without any parameters, the application should, for every assignment, output the number of submissions, and the minimal, maximal, and average grades for the whole class. For Example:
    rees$ app
                            #submitted  min-grade max-grade average
      ER Diagrams (A1)             125       4.00     20.00   17.55
      SQL (A2)                     103      19.00     99.00   87.33
      Embedded SQL (A3)              0
      Midterm (ME)                 145      44.00    105.00   84.25
      Final (FE)                     1      80.00     80.00   80.00
    
    Note that for assignments for which there are no submissions, the statistical information is omitted.
All parameters of the application must be obtained from the command line.

The application should also provide appropriate error messages when invalid student or assignment ids are entered or when the grade exceeds the maximal grade allowed for that assignment.


Fine print: the usual university policies on academic honesty, fair use of computing facilities, etc., here.