Next: Sequences, Collaborations, Activities, States
Up: Lecture 2: Classes, Objects,
Previous: Commentary
- 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:
- name:
Figure
,
- attributes:
size
of class Size
, pos
of class Position
, figCounter
of type Integer and of class scope, x
and y
both of Integer type and of default value 0 with private visibility,
- operations:
draw()
with public visibility, getCounter()
returning Integer value and of class scope, scaleFigure
of public visibility and with an Integer parameter percent
defaulted to 25, reSize
of public visibility and with 2 Integer parameters percentX
and percentY
both defaulted to 25, returnPos()
of class Position
and of public visibility,
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
|
- 9.
- Draw a class diagram to model an Insurance Business with the following class relationships:
- An insurance company has insurance contracts which refer to 1 or more customers
- A customer has insurance contracts (zero or more), which refer to one insurance company.
- An insurance contract is between an insurance company and one or more customers. The insurance contract refers to both a customer (or customers) and an insurance company
- The insurance contract is expressed in an (zero or more) insurance policy (a written contract of insurance)
- The insurance policy refers to the insurance contract.
- 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: Sequences, Collaborations, Activities, States
Up: Lecture 2: Classes, Objects,
Previous: Commentary
Ananda Amatya
11/3/1999