/****************************************************************************** Notengebung bei der 2. EBKFS-Klausur WS06/07 Regeln: 1. Punkte in Miniklausuren und Übungspunkte geben den zu Beginn der Vorlesung versprochenen Bonus (siehe Fktnen mini1Ex, ...) 2. Die 3 Bonuswerte werden addiert und dann "schief" gerunded. Ausser bei Rundung auf 0.33 stellt das schiefe Runden die Studierenden besser. Ein Gesamtbonus von 0.2 oder kleiner ist nicht aufrundenswert. (siehe Fktn biasRound). 3. Die Klausurnote wird aus Punktebereichen ermittelt (siehe Fktn examination) 4. Die Gesamtnote ergibt sich als -- 5.0, falls die Klausurnote schon 5.0 ist -- 1.0, falls Klausurnote - Bonus <= 1.0 -- Klausurnote - Bonus sonst Dabei wird im System der Drittelnoten gerechnet ******************************************************************************/ #include #include #include #include #include /* output in LSF format, exer/exam points, or even single exercise points */ #define LSF 0 #define TOTAL 1 #define FULL 99 /* to be set as compile option: */ // INTERACTIVE /* interactive or batch mode */ // OUTPUT /* see output modes above */ /* best possible exercise data */ #define MAX_FST 70 /* maximum points in first mini-exam */ #define MAX_SND 65 /* maximum points in second mini-exam */ #define MAX_EXC 120 /* maximum points in exercises */ /****************************************************************************** *** evaluation *** ******************************************************************************/ /* first mini -exam */ double mini1Ex(double x) { /* exact bonus of first mini-exam */ if (x >= 60) return(0.25); if (x >= 49) return(0.20); if (x >= 39) return(0.15); if (x >= 28) return(0.10); return(0.00); } /* second mini -exam */ double mini2Ex(double x) { /* exact bonus of second mini-exam */ if (x >= 56) return(0.25); if (x >= 46) return(0.20); if (x >= 36) return(0.15); if (x >= 26) return(0.10); return(0.00); } /* exercises */ double exerciseEx(double x) { /* exact bonus of exercises */ if (x >= 108) return(0.50); if (x >= 96) return(0.40); if (x >= 84) return(0.30); if (x >= 72) return(0.20); if (x >= 60) return(0.10); return(0.00); } double examination(double x) { /* exact evaluation of exam in LSF form: 230 = 2.3, 370 = 3.7 */ if (x >= 104) return(100); if (x >= 97) return(130); if (x >= 93) return(170); if (x >= 82) return(200); if (x >= 80) return(230); if (x >= 75) return(270); if (x >= 67) return(300); if (x >= 64) return(330); if (x >= 62) return(370); if (x >= 50) return(400); return(500); } /****************************************************************************** *** rounding *** ******************************************************************************/ double biasRound(double x) { if (x <= 0.20) return( 0); /* 0.0 for x in [0.00,0.20] */ if (x < 0.44) return(30); /* 1/3 for x in ]0.25,0.44[ */ if (x < 0.79) return(70); /* 2/3 for x in [0.44,0.79[ */ return(100); /* 3/3 for x in [0.79,1.00] */ } /****************************************************************************** *** batch computation *** ******************************************************************************/ void computeTotal() { char fname[256]; char sname[256]; char matnr[256]; /* variables to be set from input file */ double exerPts, m1Pts, m2Pts, examPts; int a1,a2,a3,a4,a5,a6; /* variables for intermediate evaluations */ double m1,m2,exer,exam; /* bonus, evaluation of exam and total evaluation */ double bonus, eval, total; FILE* in = fopen("PUNKTE.DAT","r"); #if (OUTPUT==LSF) FILE* out = fopen("LSF.DAT","w"); #else FILE* out = fopen("NOTEN.DAT","w"); #endif while (!feof(in)) { /* read entry */ strcpy(fname,""); fscanf(in,"%s %s %s %d %d %d %d %d %d %lf %lf %lf %lf", sname,fname,matnr,&a1,&a2,&a3,&a4,&a5,&a6, &exerPts,&m1Pts,&m2Pts,&examPts); if (!strcmp(fname,"")) break; #if (OUTPUT == LSF) /* no participation */ if (examPts <= 0) { /* 0 points in exam ==> no participation ? */ fprintf(out,"%s\t%s\t%s\t%.1lf\t%.1lf\t%.1lf\t%.1lf\tNT\n", sname,fname,matnr,exerPts,m1Pts,m2Pts,examPts); continue; } #endif /* compute bonus */ m1 = mini1Ex(m1Pts); m2 = mini2Ex(m2Pts); exer = exerciseEx(exerPts); bonus = biasRound(m1 + m2 + exer); /* compute evaluation of examination */ eval = examination(examPts); /* compute total evaluation */ total = eval; if (eval <= 450 && bonus > 0) { /* examination is passed, bonus is > 0 */ if (eval - bonus < 100) /* 100 is best possible total */ total = 100; else { total = total - bonus; /* corrections for LSF */ if ((int) total % 100 == 60) total += 10; if ((int) total % 100 == 80) total -= 10; if ((int) total % 100 == 20) total += 10; if ((int) total % 100 == 40) total -= 10; } } /* write output file */ #if (OUTPUT == LSF) fprintf(out,"%s\t%s\t%s\t%.1lf\t%.1lf\t%.1lf\t%.1lf\t%.0lf\n", sname,fname,matnr,exerPts,m1Pts,m2Pts,examPts,total); #elif (OUTPUT == TOTAL) fprintf(out, "%s\t%s\t%s\t%.1lf\t%.1lf\t%.1lf\t%.1lf\t%.0lf\t%.0lf\t%.0lf\n", sname,fname,matnr,exerPts,m1Pts,m2Pts,examPts,eval,bonus,total); #elif (OUTPUT == FULL) fprintf(out, "%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%.1lf\t%.1lf\t%.1lf\t%.1lf\t%.0lf\t%.0lf\t%.0lf\n", sname,fname,matnr,a1,a2,a3,a4,a5,a6, exerPts,m1Pts,m2Pts,examPts,eval,bonus,total); #endif } /* while ... */ fclose(in); fclose(out); } /****************************************************************************** *** interactive computation *** ******************************************************************************/ computeInteractive() { /* variables for points */ double m1Pts,m2Pts,exerPts,examPts; /* variables for intermediate evaluations */ double m1,m2,exer,exam; /* bonus, evaluation of exam and total evaluation */ double bonus, eval, total; char str[256]; printf("**************************************************************\n"); printf(" Berechnung der Gesamtnote für BKFS 06/07\n"); printf("**************************************************************\n"); printf("\n"); printf("Übungspunkte > "); fgets(str,256,stdin); exerPts = atof(str); printf("Punkte 1.Miniklausur > "); fgets(str,256,stdin); m1Pts = atof(str); printf("Punkte 2.Miniklausur > "); fgets(str,256,stdin); m2Pts = atof(str); printf("Punkte Klausur > "); fgets(str,256,stdin); examPts = atof(str); /* compute bonus */ exer = exerciseEx(exerPts); m1 = mini1Ex(m1Pts); m2 = mini2Ex(m2Pts); bonus = biasRound(m1 + m2 + exer); /* compute evaluation of examination */ eval = examination(examPts); /* compute total evaluation */ total = eval; if (eval <= 450 && bonus > 0) { /* examination is passed, bonus is > 0 */ if (eval - bonus < 100) /* 100 is best possible total */ total = 100; else { total = total - bonus; /* corrections for LSF */ if ((int) total % 100 == 60) total += 10; if ((int) total % 100 == 80) total -= 10; if ((int) total % 100 == 20) total += 10; if ((int) total % 100 == 40) total -= 10; } } printf("Klausurnote: %.1lf\n",eval/100); printf("Bonusnote : %.1lf\n",bonus/100); printf("Gesamtnote : %.1lf (= %.1lf - %.1lf)\n", total/100,eval/100,bonus/100); } /* interactive */ /****************************************************************************** *** main *** ******************************************************************************/ int main (int argc, char ** argv) { #ifdef INTERACTIVE computeInteractive(); exit(0); #endif /* compute input from input file and write output file */ computeTotal(); }