; ---------------------- ; cscC24 - Project # 1 ; Test file - Jason Gray ; ---------------------- ; -------------------------------------------- ; ; Define marks ; (define m1_a 0) (define m1_b 0) (define m1_c 0) (define m2 0) (define m3 0) (define m4 0) (define m5 0) (define m6 0) (define m7_a 0) (define m7_b 0) (define m7_c 0) (define m7_d 0) ; returns the actual mark based on the mark and what it was out of. Eg: 3/5 yields 1/5. (define (calcmark mark outof) (max 0 (- outof (* (- outof mark) 2))) ) ; Define weights (define w1_a 1) (define w1_b (/ 3 2)) (define w1_c (/ 3 5)) (define w2 (/ 5 3)) (define w3 (/ 6 5)) (define w4 (/ 6 8)) (define w5 (/ 6 7)) (define w6 (/ 8 12)) (define w7_a (/ 5 2)) (define w7_b (/ 5 5)) (define w7_c (/ 5 4)) (define w7_d (/ 5 8)) ; ; Definition of setequality ; (define (jason_mysubset s1 s2) (cond ((null? s1) #t) ((list? (car s1)) (and (jason_mymember (car s1) (jason_allLists s2)) (jason_mysubset (cdr s1) s2) )) (else (and (member (car s1) s2) (jason_mysubset (cdr s1) s2) ) ) ) ) (define (jason_allLists l) (cond ((null? l) ()) ((list? (car l)) (cons (car l) (jason_allLists (cdr l)))) (else (jason_allLists (cdr l))) ) ) (define (jason_mymember l1 l2) (cond ((null? l2) ()) (else (jason_mymember-helper l1 l2)) ) ) (define (jason_mymember-helper l1 l2) (or (and (jason_mysubset l1 (car l2)) (jason_mysubset (car l2) l1) ) (jason_mymember l1 (cdr l2)) ) ) ;; added condition that sets must be same length, so that (jason_seteq? '(a) '(a a)) will not return #t (define (jason_seteq? s1 s2) (and (= (length s1) (length s2)) (jason_mysubset s1 s2) (jason_mysubset s2 s1) ) ) ; -------------------------------------------- ; Load the test DB. NB: This is the same as the sample DB given in the assignment handout ; with csc50? courses added (define COURSES '((csc101 csc102 Petty) (csc102 NONE Petty csc101 mat101) (csc201 csc202 Vega (csc102 ece105) mat101) (csc202 csc330 Gabriel csc201) (csc230 csc330 Vega csc201 mat102) (csc330 NONE Vega (csc202 csc230) mat102) (csc340 csc341 Gabriel csc202) (csc341 NONE Gabriel csc340) (csc380 NONE Gabriel csc102) (mat102 NONE Lee mat101) (csc500 NONE Smith (csc202 csc230) ece105) (csc501 NONE Smith (csc202 csc330) ece105) (csc502 NONE Smith csc500 csc330) (csc503 NONE Smith csc501 csc330) (csc504 NONE Smith mat102 csc102) (csc601 none Levin (mat101 mat102) ece105 csc380 (csc340 csc330 csc341 csc230) csc202 csc501)) ) ; -------------------------------------------- ; Load the students assignment (load "cl.scm") ; -------------------------------------------- ; ***** ; Question # 1. Total marks: 9 (3 for each part) ; ***** ; ; Question # 1 (a) ; (if (eq? (SEQ 'csc101) 'csc102) (set! m1_a (+ m1_a w1_a)) (display "not correct for (SEQ 'csc101)") ) (if (eq? (SEQ 'mat102) 'none) (set! m1_a (+ m1_a w1_a)) (display "not correct for (SEQ 'mat102)") ) (if (eq? (SEQ 'ece105) 'none) (set! m1_a (+ m1_a w1_a)) (display "not correct for (SEQ 'ece105)") ) ; ; Question # 1 (b) ; (if (eq? (PROF 'csc202) 'gabriel) (set! m1_b (+ m1_b w1_b)) (display "not correct for (PROF 'csc202)") ) (if (eq? (PROF 'ece105) 'none) (set! m1_b (+ m1_b w1_b)) (display "not correct for (PROF 'ece105)") ) ; ; Question # 1 (c) ; (if (jason_seteq? (PREREQS 'csc101) '()) (set! m1_c (+ m1_c w1_c)) (display "not correct for (PREREQS 'csc101)") ) (if (jason_seteq? (PREREQS 'csc102) '(csc101 mat101)) (set! m1_c (+ m1_c w1_c)) (display "not correct for (PREREQS 'csc102)") ) (if (jason_seteq? (PREREQS 'csc201) '((csc102 ece105) mat101)) (set! m1_c (+ m1_c w1_c)) (display "not correct for (PREREQS 'csc201)") ) (if (jason_seteq? (PREREQS 'ece105) '()) (set! m1_c (+ m1_c w1_c)) (display "not correct for (PREREQS 'ece105)") ) (if (jason_seteq? (PREREQS 'csc601) '((mat101 mat102) ece105 csc380 (csc340 csc330 csc341 csc230) csc202 csc501)) (set! m1_c (+ m1_c w1_c)) (display "not correct for (PREREQS 'csc601)") ) ; -------------------------------------------- ; ***** ; Question # 2. Total marks: 5 ; ***** (if (jason_seteq? (TEACHES 'lee) '(mat102)) (set! m2 (+ m2 w2)) (display "not correct for (TEACHES 'lee)") ) (if (jason_seteq? (TEACHES 'vega) '(csc201 csc230 csc330)) (set! m2 (+ m2 w2)) (display "not correct for (TEACHES 'vega)") ) (if (jason_seteq? (TEACHES 'Lester) '()) (set! m2 (+ m2 w2)) (display "not correct for (TEACHES 'Lester)") ) ; -------------------------------------------- ; ***** ; Question # 3. Total marks: 6 ; ***** (if (jason_seteq? (PREREQ-OF 'csc101) '(csc102)) (set! m3 (+ m3 w3)) (display "not correct for (PREREQ-OF 'csc101)") ) (if (jason_seteq? (PREREQ-OF 'csc102) '(csc201 csc380 csc504)) (set! m3 (+ m3 w3)) (display "not correct for (PREREQ-OF 'csc102)") ) (if (jason_seteq? (PREREQ-OF 'csc380) '(csc601)) (set! m3 (+ m3 w3)) (display "not correct for (PREREQ-OF 'csc380)") ) (if (jason_seteq? (PREREQ-OF 'ece201) '()) (set! m3 (+ m3 w3)) (display "not correct for (PREREQ-OF 'ece201)") ) (if (jason_seteq? (PREREQ-OF 'csc601) '()) (set! m3 (+ m3 w3)) (display "not correct for (PREREQ-OF 'ece201)") ) ; -------------------------------------------- ; ***** ; Question # 4. Total marks: 6 ; ***** (if (eq? (ALLOWED? 'csc101 '()) #t) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'csc101 '())") ) (if (eq? (ALLOWED? 'csc101 '(csc102 csc201 mat102)) #t) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'csc101 '(csc102 csc201 mat102))") ) (if (eq? (ALLOWED? 'csc330 '(csc230 mat102)) #t) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'csc330 '(csc230 mat102))") ) (if (eq? (ALLOWED? 'csc330 '(csc202 csc230)) ()) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'csc330 '(csc202 csc230))") ) (if (eq? (ALLOWED? 'ece105 '(csc101 csc102)) ()) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'ece105 '(csc101 csc102))") ) (if (eq? (ALLOWED? 'csc102 '(csc101 mat101)) #t) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'csc102 '(csc101 mat101))") ) (if (eq? (ALLOWED? 'csc330 '(mat101 csc101)) ()) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'csc330 '(mat101 csc101))") ) (if (eq? (ALLOWED? 'csc601 '(mat101)) ()) (set! m4 (+ m4 w4)) (display "not correct for (ALLOWED? 'csc601 '(mat101))") ) ; -------------------------------------------- ; ***** ; Question # 5. Total marks: 6 ; ***** (if (jason_seteq? (ALL-ALLOWED '()) '(csc101)) (set! m5 (+ m5 w5)) (display "not correct for (ALL-ALLOWED '())") ) (if (jason_seteq? (ALL-ALLOWED '(csc101)) '()) (set! m5 (+ m5 w5)) (display "not correct for (ALL-ALLOWED '(csc101))") ) (if (jason_seteq? (ALL-ALLOWED '(csc101 mat101)) '(csc102 mat102)) (set! m5 (+ m5 w5)) (display "not correct for (ALL-ALLOWED '(csc101 mat101))") ) (if (jason_seteq? (ALL-ALLOWED '(ece105 mat101)) '(csc101 csc201 mat102)) (set! m5 (+ m5 w5)) (display "not correct for (ALL-ALLOWED '(ece105 mat101))") ) (if (jason_seteq? (ALL-ALLOWED '(csc101 csc102 csc201)) '(csc202 csc380)) (set! m5 (+ m5 w5)) (display "not correct for (ALL-ALLOWED '(csc101 csc102 csc201))") ) (if (jason_seteq? (ALL-ALLOWED '(ece201)) '(csc101)) (set! m5 (+ m5 w5)) (display "not correct for (ALL-ALLOWED '(ece201))") ) (if (jason_seteq? (ALL-ALLOWED '(csc601)) '(csc101)) (set! m5 (+ m5 w5)) (display "not correct for (ALL-ALLOWED '(csc601))") ) ; -------------------------------------------- ; ***** ; Question # 6. Total marks: 8 ; ***** (if (jason_seteq? (PREREQS-REC 'csc101) '()) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc101)") ) (if (jason_seteq? (PREREQS-REC 'csc102) '(csc101 mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc102)") ) (if (jason_seteq? (PREREQS-REC 'csc201) '((csc102 ece105) mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc201)") ) (if (jason_seteq? (PREREQS-REC 'csc202) '(csc201 (csc102 ece105) mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc202)") ) (if (jason_seteq? (PREREQS-REC 'csc230) '(csc201 mat102 (csc102 ece105) mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc230)") ) (if (jason_seteq? (PREREQS-REC 'csc330) '((csc202 csc230) mat102 mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc330)") ) (if (jason_seteq? (PREREQS-REC 'csc341) '(csc340 csc202 csc201 (csc102 ece105) mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc341)") ) (if (jason_seteq? (PREREQS-REC 'ece105) '()) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'ece105)") ) (if (jason_seteq? (PREREQS-REC 'csc502) '(csc500 csc330 ece105 (csc202 csc230) mat102 mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc502)") ) (if (jason_seteq? (PREREQS-REC 'csc503) '(csc501 csc330 (csc202 csc330) ece105 (csc202 csc230) mat102 mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc503)") ) (if (jason_seteq? (PREREQS-REC 'csc504) '(mat102 csc102 csc101 mat101)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc504)") ) (if (jason_seteq? (PREREQS-REC 'csc601) '((mat101 mat102) csc380 (csc340 csc330 csc341 csc230) csc202 csc501 csc102 csc101 csc201 (csc102 ece105) mat101 (csc202 csc330) ece105)) (set! m6 (+ m6 w6)) (display "not correct for (PREREQS-REC 'csc601)") ) ; -------------------------------------------- ; ***** ; Question # 7. Total marks: 20 (5 for each part) ; ***** ; ; Question # 7 (a) ; (if (jason_seteq? (CLASSES-PROFS '(vega lee)) '(csc201 csc230 csc330 mat102)) (set! m7_a (+ m7_a w7_a)) (display "not correct for (CLASSES-PROFS '(vega lee))") ) (if (jason_seteq? (CLASSES-PROFS '(vega who)) '(csc201 csc230 csc330)) (set! m7_a (+ m7_a w7_a)) (display "not correct for (CLASSES-PROFS '(vega who))") ) ; ; Question # 7 (b) ; (if (jason_seteq? (ALLOWED-PROFS '()) '(petty)) (set! m7_b (+ m7_b w7_b)) (display "not correct for (ALLOWED-PROFS '())") ) (if (jason_seteq? (ALLOWED-PROFS '(ece105)) '(petty)) (set! m7_b (+ m7_b w7_b)) (display "not correct for (ALLOWED-PROFS '(ece105))") ) (if (jason_seteq? (ALLOWED-PROFS '(csc101 mat101)) '(petty lee)) (set! m7_b (+ m7_b w7_b)) (display "not correct for (ALLOWED-PROFS '(csc101 mat101))") ) (if (jason_seteq? (ALLOWED-PROFS '(csc201 csc340)) '(petty gabriel)) (set! m7_b (+ m7_b w7_b)) (display "not correct for (ALLOWED-PROFS '(csc201 csc340))") ) (if (jason_seteq? (ALLOWED-PROFS '(csc601)) '(petty)) (set! m7_b (+ m7_b w7_b)) (display "not correct for (ALLOWED-PROFS '(csc601))") ) ; ; Question # 7 (c) ; (if (jason_seteq? (ALL-SEQ '(csc101 mat101)) '(csc102)) (set! m7_c (+ m7_c w7_c)) (display "not correct for (ALL-SEQ '(csc101 mat101))") ) (if (jason_seteq? (ALL-SEQ '(csc101 csc102 csc201 mat101 mat102)) '(csc202)) (set! m7_c (+ m7_c w7_c)) (display "not correct for (ALL-SEQ '(csc101 csc102 csc201 mat101 mat102))") ) (if (jason_seteq? (ALL-SEQ '()) '()) (set! m7_c (+ m7_c w7_c)) (display "not correct for (ALL-SEQ '())") ) (if (jason_seteq? (ALL-SEQ '(ece105)) '()) (set! m7_c (+ m7_c w7_c)) (display "not correct for (ALL-SEQ '(ece105))") ) ; ; Question # 7 (d) ; (if (jason_seteq? (NEEDED '(csc101 mat101) '(csc102)) '()) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '(csc101 mat101) '(csc102))") ) (if (jason_seteq? (NEEDED '(csc101 csc102) '(csc340 csc380)) '(csc202)) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '(csc101 csc102) '(csc340 csc380))") ) (if (jason_seteq? (NEEDED '(csc101 csc102 csc201 mat101) '(csc230 csc330)) '((csc202 csc230) mat102)) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '(csc101 csc102 csc201 mat101) '(csc230 csc330))") ) (if (jason_seteq? (NEEDED '() '(csc101 mat101)) '()) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '() '(csc101 mat101))") ) (if (jason_seteq? (NEEDED '(csc101) '(ece105)) '()) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '(csc101) '(ece105))") ) (if (jason_seteq? (NEEDED '(ece105) '(csc201 csc202)) '(mat101 csc201)) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '(ece105) '(csc201 csc202))") ) (if (jason_seteq? (NEEDED '(csc101) '()) '()) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '(csc101) '())") ) (if (jason_seteq? (NEEDED '(mat101) '(csc601)) '(ece105 csc380 (csc340 csc330 csc341 csc230) csc202 csc501)) (set! m7_d (+ m7_d w7_d)) (display "not correct for (NEEDED '(mat101) '(csc601))") ) ; -------------------------------------------- ; ; Output totals ; ; round down fractional marks (set! m1_a (floor m1_a)) (set! m1_b (floor m1_b)) (set! m1_c (floor m1_c)) (set! m2 (floor m2)) (set! m3 (floor m3)) (set! m4 (floor m4)) (set! m5 (floor m5)) (set! m6 (floor m6)) (set! m7_a (floor m7_a)) (set! m7_b (floor m7_b)) (set! m7_c (floor m7_c)) (set! m7_d (floor m7_d)) ; Calculate actual mark (set! m1_a (calcmark m1_a 3)) (set! m1_b (calcmark m1_b 3)) (set! m1_c (calcmark m1_c 3)) (set! m2 (calcmark m2 5)) (set! m3 (calcmark m3 6)) (set! m4 (calcmark m4 6)) (set! m5 (calcmark m5 6)) (set! m6 (calcmark m6 8)) (set! m7_a (calcmark m7_a 5)) (set! m7_b (calcmark m7_b 5)) (set! m7_c (calcmark m7_c 5)) (set! m7_d (calcmark m7_d 5)) (list "Question 1 a: " m1_a 'out 'of 3) (list "Question 1 b: " m1_b 'out 'of 3) (list "Question 1 c: " m1_c 'out 'of 3) (list "Question 2: " m2 'out 'of 5) (list "Question 3: " m3 'out 'of 6) (list "Question 4: " m4 'out 'of 6) (list "Question 5: " m5 'out 'of 6) (list "Question 6: " m6 'out 'of 8) (list "Question 7 a: " m7_a 'out 'of 5) (list "Question 7 b: " m7_b 'out 'of 5) (list "Question 7 c: " m7_c 'out 'of 5) (list "Question 7 d: " m7_d 'out 'of 5) (list "Total correctness mark: " (+ m1_a m1_b m1_c m2 m3 m4 m5 m6 m7_a m7_b m7_c m7_d)) (exit) y