Example solutions to TDDC32 exam 09-06-12 ========================================= 1) a) Requirements and use cases b) Find objects(classes) and relations. CRC cards (or other short class descriptions) Initial class diagram. Initial interaction diagrams. c) Detailed class diagrams. Detailed interaction diagrams. Other diagrams needed to specify the system in detail. 2) Interfaces: Vehicle, Motor, Man. Classes: Garage, Big, Small, Car, MC, Bicycle, Wheel. <---- = inheritance <**** = implementation ..... = other relations All classes should look like +-----+ |Class| +-----+ +-----+ +-----+ but here I'm saving some space. * 1 +-------+...................+------+ +---->|Vehicle|<*************+ |Garage| | +-------+<***+ * +------+ | ^ * * | | * * | | * * 4 +-----+ +-----+ +-----+<>...+.........+-----+ |Motor| | Man | | Big | * |Wheel| +-----+ +-----+ +-----+ +-----+<>...+-----+ ^ ^ ^ ^ |Small| 2 * * * | +-----+ * * +****+ | ^ ^ * * * | | | * * +-----+--+---------+ | * +******+ | * | | * * | * | +---------+ * +------+-+-----+--+ | * | * | * | +-----+ +----+ +-------+ | Car | | MC | |Bicycle| +-----+ +----+ +-------+> 3) a) __4__ ___4___ 2 5 2 6 / \ \ ; / \ / \ 1 3 6 1 3 5 7 b) ___20____ ___10___ 10 30 7 20 /\ /\ --> / \ /\ / \ / \ / \ / \ 7 14 25 35 3 9 14 30 / \ / / / /\ 3 9 12 1 12 25 35 / 1 4) a) 20 20 38 /\ /\ / \ 10 30 10 30 30 39 /\ \ /\ \ /\ \ 7 14 35 ---> 7 14 38 ---> 20 35 46 \ /\ / / \ 39 35 39 10 41 55 /\ \ /\ 38 46 46 7 14 /\ /\ 41 55 41 55 b) If deleting 46 consists of moving information from the 55 node to the 46 node and then really deleting the (old, now empty) 55 node, then splay should be performed on the new 55/old 46 node: 20 55 /\ __20__ / 10 30 10 30 30 /\ \ /\ \ /\ 7 14 35 ---> 7 14 55 ---> 20 39 \ / / /\ 39 39 10 35 41 \ /\ /\ 55 35 41 7 14 / 41 If deleting 46 consists of moving the 55 node to the place of the 46 node and really deleting the 46 node, then splaying should be performed on the 39 node: 20 /\ __20__ __39__ 10 30 10 39 20 55 /\ \ /\ /\ / \ / 7 14 35 ---> 7 14 35 55 ---> 10 35 41 \ / / /\ / 39 30 41 7 14 30 \ 55 / 41