CIS 459.21 LAB3

*** Due Date: Wednesday 5/18/2005 11:59pm ***


Points: 100


In this lab, you are a teaching assistant for a professor of a class with 10 students. The whole quarter is approaching to the end. The professor needs your help organizing the final report of the class. You have only a short summary of students' midterm and final exam scores. Details are as follows:

  1. The total scores for midterm and final are both 100. But midterm is only 40% of the total grade, final 60%.
  2. The grade is decided based on the following scale.
         A:  90 and above,
         B:  80 to 89,
         c:  70 to 79, 
         d:  69 and lower.
  3. You need to calculate the final score for students and report their final grade accordingly. For example, if John has scored 80 in the midterm and 90 in the final, his total score is 86 and his grade B.
  4. You have to define a structure, struct student, to describe all the information related to a student, including name, midterm, finalexam, total and grade. You may use the following:
    	 struct student {
    		 struct student * next;
    		 char name[20];
    		 int  midterm;
    		 /* more to be filled in */
  5. Your report of the grades should have the students sorted in the order of their grades. For example, if you are given the following summary.
        Steeve  70     80     
        John    80     90    
    Your report should be as follows.
        Name   Midterm Final  Total  Grade
        John     80     90     86     B
        Steeve   70     80     76     C

Note: You are also given an incomplete driver program, lab3.c, that contains the main function. You need to do the following:

  1. Complete this header file, student.h, as an interface that you can handle each student struct. You need to complete both the structure definition and the function prototypes.
  2. Complete this implementation, student.c, mainly the functions defined in the above API header file.
  3. If necessary, modify or complete the main program, lab3.c.
  4. If you use additional library functions, you also need to include their header file, for example, string.h.


With your interests in 459.21, I am assuming you are interested in system programming. So you are required to meet the following requirements:

  1. Document your programs well.
  2. Following a good coding style (see course page for links to different coding styles).
    In the worst case, use the indent program to process your source file before your submission.
  3. Provide a Makefile that compile your API header and source files first, and compile the main program lab3.c in a separate step.
    Your Makefile must have at least two targets: lab3 and clean.
    A sample Makefile is provided here. A link to GNU Makefile manual is available here.


When you finish with the lab, you need to turn it in for grading. The submit command submits your lab electronically. You MUST use the submit command to turn in your labs. The format of submit command is as follows:

submit classname labname files-to-submit

where, to submit your first lab for this class, use the following command from the directory which contains source files (lab3.c and Makefile):

submit c459.21aa lab3 lab3.c Makefile student.c student.h

Last updated: Sun Apr 10 00:00:45 EDT 2005