; Excerpts from the Scheme code used to compute final grades. ; Numerical nonsense. (define (num n) (if (number? n) n 0)) (define (round1 x) (/ (round (* 10.0 x)) 10.0)) ; Curves. ; ; In addition to curving the final exam as shown below, ; I weighted the midterm as heavily as I weighted the final. ; Normally the final exam is weighted about 50% more heavily ; than the midterm. (define (curve-midterm n) n) (define (curve-final n) (+ n 13)) ; Curving without extra credit assignment. (define (curve-homework0 q1 q2 h1 h2 h3 h4 h5) (let ((q1 (num q1)) (q2 (num q2)) (h1 (num h1)) (h2 (num h2)) (h3 (num h3)) (h4 (num h4)) (h5 (num h5))) (* 100.0 (/ (+ (max q1 q2) h1 h2 h3 h4 h5) (+ 5 (apply + possible-hw)))))) ; Curving with extra credit assignment. (define (curve-homework q1 q2 h1 h2 h3 h4 h5 xtra) (let* ((xtra (num xtra)) (fraction (/ xtra 20))) (define (z pts) (* fraction pts)) (max (curve-homework0 q1 q2 h1 h2 h3 h4 h5) (curve-homework0 (z 5) q2 h1 h2 h3 h4 h5) (curve-homework0 q1 (z 5) h1 h2 h3 h4 h5) (curve-homework0 q1 q2 (z 10) h2 h3 h4 h5) (curve-homework0 q1 q2 h1 (z 15) h3 h4 h5) (curve-homework0 q1 q2 h1 h2 (z 15) h4 h5) (curve-homework0 q1 q2 h1 h2 h3 (z 15) h5) (curve-homework0 q1 q2 h1 h2 h3 h4 (z 26))))) (define (rawscore x) (let* ((hw (apply curve-homework (map (lambda (f) (f x)) (list qz1 qz2 hw1 hw2 hw3 hw4 hw5 ec)))) (test1 (curve-midterm (num (midterm x)))) (test2 (curve-final (num (final x)))) ) (round1 (+ (* .50 hw) (* .50 (/ (+ test1 test2) 2.0)))))) (define (lettergrade n) ;(define n (+ n0 5)) (cond ((>= n 93.0) "A ") ((>= n 90.0) "A-") ((>= n 87.0) "B+") ((>= n 83.0) "B ") ((>= n 80.0) "B-") ((>= n 77.0) "C+") ((>= n 73.0) "C ") ((>= n 70.0) "C-") ((>= n 67.0) "D+") ((>= n 63.0) "D ") ((>= n 60.0) "D-") (else "F ")))