FINAL COM 1205 Winter 2003 Karl Lieberherr Software Design and Development ======================================================================== Open book and open notes 1: 23 points parsing, printing, 3-way pattern matching 2: 52 points write semantic checker 3: 21 points Don't Repeat Yourself Principle 4: 33 points predict output of program 5: 20 points class dictionary design --- 149 points Question 1: ================================================== UNKNOWN1 = X UNKNOWN2 = ( UNKNOWN3 = A UNKNOWN4 = b UNKNOWN5 = Corresp UNKNOWN6 = QualifiedClass UNKNOWN7 = cdname UNKNOWN8 = CdName UNKNOWN9 = ident UNKNOWN10 = Ident "X" UNKNOWN11 = classname UNKNOWN12 = ClassName UNKNOWN13 = ident UNKNOWN14 = Ident "C" UNKNOWN15 = QualifiedClass UNKNOWN16 = C UNKNOWN17 = t1 UNKNOWN18 = X UNKNOWN19 = A UNKNOWN20 = C UNKNOWN21 = Y UNKNOWN22 = C UNKNOWN23 = E Question 2: ============================================================== UNKNOWN1 = cg UNKNOWN2 = gather UNKNOWN3 = Input UNKNOWN4 = " via -> *,cds,* " UNKNOWN5 = CdName UNKNOWN6 = cg UNKNOWN7 = gather UNKNOWN8 = Input UNKNOWN9 = " via {-> *,cdglue,*, -> *,travs,*} " (or bypassing "via ->*,cds,*") UNKNOWN10 = CdName UNKNOWN11 = defined UNKNOWN12 = containsAll UNKNOWN13 = used Question 3:(several variations are also correct) ================================================== UNKNOWN1 = String UNKNOWN2 = whereToGo UNKNOWN3 = int UNKNOWN4 = kind UNKNOWN5 = " via -> *, " + UNKNOWN2 + " ,* " UNKNOWN6 = if (kind==1) l.remove(0); else l.remove(l.size()-1); UNKNOWN7 = List l1 = i.gather(cg2,"from1",1); List l2 = i.gather(cg2,"to1", 2); Question 4: ================================================== UNKNOWN1 = X UNKNOWN2 = Y UNKNOWN3 = Z UNKNOWN4 = U UNKNOWN5 = C UNKNOWN6 = E UNKNOWN7 = D UNKNOWN8 = C UNKNOWN9 = E UNKNOWN10 = D UNKNOWN11 = true Question 5: ================================================== UNKNOWN1 = Segment = "in" CdName "from" ClassName List(Constraint) "to" ClassName. UNKNOWN2 = Constraint : Via | Bypassing common CList(ClassName). Via = "via". Bypassing = "bypassing". List(S) ~ {S} . CList(S) ~ "{" S {"," S} "}".