Software Design and Development Fall 1996 Final exam Question 1: 7 UNKNOWNs /proj/asl/lieber/java/java-envs/jk-smallest Consider the following behavior file program.beh. Find the SMALLEST (in terms of number of characters) class dictionary program.cd so that program.beh and program.cd result in an executable Java program. program.beh ============================ A{ traversal t(V v) { to D;} } ClassGraph { traversal f() { to *;} } V { before B (@ set_i(new Integer(5)); @) before C (@ System.out.println(get_i()); @) before D (@ Q q = new R(); @) } Main { (@ static public void main(String args[]) throws Exception { ClassGraph a = ClassGraph.parse(System.in); a.f(); A a1 = A.parse(System.in); V v = new V(); a1.t(v); System.out.println("done "); } @) } Fill in the UNKNOWNS below in file program.cd: A = UNKNOWN1. B = UNKNOWN2. C = UNKNOWN3. D = . V = UNKNOWN4 . UNKNOWN5 = . Main = . UNKNOWN6 : UNKNOWN7. R = . Question 3: Write a class dictionary for your favorite video store. You will use the class dictionary to keep track of customers, rentals and returns and of fines. Write a program for your video store which prints the list of videos which have been checked-out. Question 4: ================================================================= Consider the following sentence describing an object (program.input): A = call f1(A,B). B = call f2(C,A). C = 3. D = call f(A, B, C). The class dictionary is program.cd: EquationSystem = UNKNOWN1(UNKNOWN2). Equation = Variable UNKNOWN3 Exp UNKNOWN4 . Exp : UNKNOWN5 | Variable | UNKNOWN6. FunctionCall = UNKNOWN7 Function UNKNOWN8(Variable) . Variable = Ident. Function = Ident. Numbe = Integer. List(S) ~ {S}. CommaList(S) ~ "(" S {"," S} ")". Find the unknowns in the following object: : UNKNOWN1 ( < UNKNOWN2 > : UNKNOWN3 { : UNKNOWN4 ( < UNKNOWN5 > : UNKNOWN6 ( < UNKNOWN7 > : Ident "A" ) < UNKNOWN8 > : UNKNOWN9 ( < UNKNOWN10 > : UNKNOWN11 ( < UNKNOWN12 > : Ident "f1" ) < UNKNOWN13 > : Variable_CommaList { : UNKNOWN14 ( < UNKNOWN15 > : Ident "A" ) , : UNKNOWN16 ( < UNKNOWN17 > : Ident "B" ) } ) ) , : UNKNOWN18 ( < UNKNOWN19 > : UNKNOWN20 ( < UNKNOWN21 > : Ident "B" ) < UNKNOWN22 > : UNKNOWN23 ( < UNKNOWN24 > : UNKNOWN25 ( < UNKNOWN26 > : Ident "f2" ) < UNKNOWN27 > : UNKNOWN28 { : UNKNOWN29 ( < UNKNOWN30 > : Ident "C" ) , : UNKNOWN31 ( < UNKNOWN32 > : Ident "A" ) } ) ) , : UNKNOWN33 ( < UNKNOWN34 > : UNKNOWN35 ( < UNKNOWN36 > : Ident "C" ) < UNKNOWN37 > : UNKNOWN38 ( < UNKNOWN39 > : Integer "3" ) ) , : UNKNOWN40 ( < UNKNOWN41 > : UNKNOWN42 ( < UNKNOWN43 > : UNKNOWN44 "D" ) < UNKNOWN45 > : UNKNOWN46 ( < UNKNOWN47 > : UNKNOWN48 ( < UNKNOWN49 > : UNKNOWN50 "f" ) < UNKNOWN51 > : UNKNOWN52 { : UNKNOWN53 ( < UNKNOWN54 > : UNKNOWN55 "UNKNOWN56" ) , : UNKNOWN57 ( < UNKNOWN58 > : UNKNOWN59 "UNKNOWN60" ) , : UNKNOWN61 ( < UNKNOWN62 > : UNKNOWN63 "UNKNOWN64" ) } ) ) } )