next up previous contents
Next: Sequences, Collaborations, Activities, States Up: Lecture 2: Classes, Objects, Previous: Commentary

Lecture 2 Exercises:

1.
Draw a class for each of the following:
(a)
name: Shape, attribute: origin, operations: move(), resize() and display();
(b)
name: CourseOffering, attribute: location, operations: getOfferings() and addLecturer().
(c)
name: LecturerCourseManager, attributes: lecturerName and courseCode, operations: getOfferings() and setOfferings().
2.
For a class with the following structure: show classes for each of the following:
(a)
Figure class with attributes and operations along with their signatures and return types (if any) that describe the size, position and count of the figure drawn;
(b)
Figure class with attributes and operations along with their signatures, return types (if any) and visibilities that describe the scaled figure drawn;
(c)
Figure class with attributes and operations along with their signature, return types (if any) and visibilities that describe the resized figure drawn;
(d)
Figure class with attributes and operations with signatures and visibilities that describe the persistent storing of the figure drawn.
3.
Give a specification for each of the following stereotyped classes:
(a)
Entry Class Course;
(b)
Entity Class CourseOffering;
(c)
Entity Class LecturerInformation;
(d)
Entity Class LecturerCourseOptions;
(e)
Boundary Class AddACourseOffering;
(f)
Control Class LecturerCourseManager.
4.
Show qualified association between an Order with several Products each with 0 or 1 Order Line.
5.
Show the ``married to'' relationship on a Person with ``husband'' and ``wife'' roles as a reflexive association.
6.
Assuming that a Lecturer teaches at most 4 CourseOfferings and that a CourseOffering is taught by only 1 Lecturer draw a class diagram to show the association between the Lecturer and CourseOffering classes including muliplicities and suitable role names.
7.
Draw a class diagram showing aggregation relationship between the classes Remix and SoundClips such that a Remix may contain 0 or more ordered sound clips and a sound clip may belong to 0 or more Remix.
8.
In the class diagram of Fig. 1 give the UML names for the model elements labelled (a), (b), and (c):
  
Figure 3.1: Class Diagram
\begin{figure}
 
\epsfig {file=classDiagram.eps}\end{figure}

9.
Draw a class diagram to model an Insurance Business with the following class relationships:

10.
For the Motor Race Information System draw the main Class diagrams giving appropriate class attributes, operations and specifications and making appropriate use of association, dependency and generalisation relationships between between the classes. Also give appropriate package diagrams.

Lecture 3: Sequences, Collaborations, Activities, States, and corresponding Diagrams

Ananda Amatya
Department of Computer Science
University of Warwick


next up previous contents
Next: Sequences, Collaborations, Activities, States Up: Lecture 2: Classes, Objects, Previous: Commentary
Ananda Amatya
11/3/1999