Object Model
Diagram Practice Problems
1. Prepare an object model diagram for the dining philosophers problem. There are 5 philosophers and 5 forks around a circular table. Each philosopher has access to 2 forks on either side. Each fork is shared by two philosophers. Each fork may be either on the table or in use by one philosopher. A philosopher must have two forks to eat.
2. Prepare an object model to describe undirected graphs. An undirected graph consists of a set of vertices and a set of edges. Edges connect pairs of vertices. Your model should capture only the structure of graphs (i.e. connectivity), and need not be concerned with geometric details such as location of vertices or lengths of edges. A typical graph is shown below.

3) The towers of Hanoi is a problem frequently used to teach recursive programming techniques. The object is to move a stack of disks from one of 3 long pegs to another, using the third peg for maneuvering. Each disk is a different size. Disks may be moved from the top of a stack on a peg to a to the top of the stack on another peg, one at a time, provided the disk is never placed on another disk that has smaller diameter. The details of the algorithm for listing the sequence of required moves will depend on the structure of the object diagram used. Prepare object diagrams for each of the following descriptions. Show object classes and association. Do not show attributes or operations.
a) A tower consists of several (3) pegs. Each peg has several disks on it, in a certain order.
b) A tower consists of several (3) pegs. Disks on the pegs are organized into subsets called stacks. A stack is an ordered set of disks. Every disk is in exactly one stack. A peg may have several stacks on it , in order.
c) a tower consists of several (3) pegs. Disks on the pegs are organized into subsets called stacks, as in (b) with several stacks on a peg. However, the structure of a stack is recursive. A stack consists of one disk (the one that is physically at the bottom of the stack) and zero or one stack, depending upon the height of the stack.
d) Similar to ( c ) except only one stack is associated with a peg. Other stacks on the peg are associated in a linked list.
4) Construct an object diagram that might be used in designing a system to simplify the scheduling and scoring of judged athletic competitions such as gymnastics, diving, and figure skating. There are several events and competitors. Each competitor may enter several events and each event has many competitors. Each event has several judges who subjectively rate the performance of each competitor in the event. A judge rates every competitor for an event. In some cases a judge may score more than one event. The focal points of the competition are trials. Each trial is an attempt by one competitor to turn in the best possible performance in one event. A trial is scored by the panel of judges for that even, and a net score determined. Add role names and multiplicity balls to the associations.