UCL Logo

Problem Class Questions 2006
for COMP1008 (Object-Oriented Programming)

Week 6 (Starting 27th February)

These questions are about reading, interpreting and drawing simple UML class and sequence diagrams.

Q1. Consider the UML Class diagram below.
a) Explain what the diagram describes.
b) Use instance objects to give examples of the systems described by this diagram.

UML Diagram

Q2. Construct your own class diagram to model the world in terms of continents, countries, neighbouring countries, cities (including capital cities), oceans and seas (showing which countries have a coastline on an ocean or sea), and languages used.

Q3. a) Identify all the classes and relationships in the class diagram below.

UML Diagram

b) Extend the diagram to model a chain of restaurants in different countries, with a regional office in each country and a head office in one country.

c) Consider the Sequence Diagram below.

UML Diagram

This diagram represents the sequence of ordering, being served and paying for food. The icons are object icons (notice the underlined names). The dotted lines are timelines, with time going forward down the page. The arrows show a message (method) call from one object to another. The open rectangles show when a method is active.

Using your answer from part b) create sequence diagrams to show:

i) How a restaurant can order food supplies for a day's menu via the local regional office (assume the regional office is responsible for ordering all food supplies for the restaurants in the same country).
ii) How all staff are paid, assuming some staff are paid weekly and others are paid monthly.

You will need to infer suitable methods that each class will need. Try role-playing or the CRC method (see appendix B in the text book) to help identify methods.

Q4. Consider this UML class diagram:
a) Describe the meaning of this diagram, defining the role of each class and association in turn.
b) Construct object diagrams showing snap-shots of objects and their links when the program corresponding to this diagram is run.
c) Determine the sequence of methods needed to perform tasks such as choosing and buying a collection of items and paying for the content of a shopping basket.

UML Diagram

Last updated: September 2, 2006

Computer Science Department - University College London - Gower Street - London - WC1E 6BT - Telephone: +44 (0)20 7679 7214 - Copyright 1999-2006 UCL


 Search by Google