Path: utzoo!attcan!uunet!ncrlnk!ncrcae!usceast!sridhar From: sridhar@usceast.UUCP (M. A. Sridhar) Newsgroups: comp.sources.wanted Subject: Re: Looking for GRADE program Message-ID: <2973@usceast.UUCP> Date: 24 Nov 89 20:48:45 GMT References: <6361@wsucsa.uucp> <478@stretch.MUN.EDU> Reply-To: sridhar@usceast.UUCP (M. A. Sridhar) Organization: University of South Carolina, Columbia Lines: 84 In article <478@stretch.MUN.EDU> tony4@stretch.MUN.EDU (Anthony H. Galway) writes: >In article <6361@wsucsa.uucp> sunderraman@wsucsa.uucp writes: > >I am looking for a program that maintains grades for various > >assignments, exams, quizzes, and projects for courses in a > >typical university. The GRADE program should be able to > >compute weighted averages, produce listings in various > >formats, produce histograms, etc. Thanks in advance. > >Raj > > Please include me also if their is one around. > Thanks. > > Tony Galway > tony4@stretch.cs.mun.ca > tony4@stretch.mun.edu I have a little awk script that I use for this purpose. It is small enough that I can post it here. Please feel free to modify in any way, but please send me copies if you add interesting features. --------------------------- CUT HERE ------------------------------------ # # grade.awk # # # Awk script for grading # # Fill in as follows: # Nckp is the total number of checkpoints (homeworks, tests, etc.) # The MAX array contains the maximum points of each checkpoint # The WT array contains the weightage of the corresponding checkpoint # The input score file contains one line for each student, with the # student's scores separated by blanks (see example below) # The variable IgnoreFlds is set to the number of fields to be ignored # (typically IgnoreFlds=2, for Name and Id number fields) # # # Sample input line in scorefile: # #Joe_Cool 999-99-9999 15 73 14 17 97 # # # Invoke with: # awk -f grade.awk scorefile # BEGIN { Nckp = 8 # Number of Checkpoints # MAX[1] = 87 ; WT[1] = 0.1 MAX[2] = 100 ; WT[2] = 0.1 MAX[3] = 50 ; WT[3] = 0.1 MAX[4] = 100 ; WT[4] = 0.1 MAX[5] = 40 ; WT[5] = 0.1 MAX[6] = 100 ; WT[6] = 0.1 MAX[7] = 100 ; WT[7] = 0.1 MAX[8] = 75 ; WT[8] = 0.3 IgnoreFlds = 1 # How many fields to ignore } # # For every input line: # { if (NF != IgnoreFlds + Nckp) { printf "Error: line %d: # fields does not match #checkpts", nlines } wght = 0 for (i = IgnoreFlds+1; i <= NF; i++) { wght += ($i* 100 / MAX[ i - IgnoreFlds ]) * WT[i - IgnoreFlds] } for (i = 1; i <= IgnoreFlds; i++) printf " %-20s ", $i for (i = IgnoreFlds+1; i <= NF; i++) printf " %3d", $i printf " %7.2f\n", wght total += wght nlines++ } END {printf "\n\n Average score: %7.2f\n", total/(nlines)} ------------------------------- CUT HERE ------------------------------------ -- M. A. Sridhar | Department of Computer Science | ncr-sd!ncrcae ! usceast!sridhar (USENET) University of South Carolina | sridhar@cs.scarolina.edu (CSNET) Columbia, SC 29208 | (803) 777-2427 (Ma Bell)