General Class Diagram Questions

  1. Draw a class diagram (schema) showing the relationship between the two parties (i.e. delegates and lecturer) in the course you are currently attending.  Make your answer specific to the current course.

  2. Draw a class diagram (schema) showing the relationship between biological parents and their children (remember children will one day become parents and an object can only belong to one class).

  3. Draw a class diagram (schema) of the relationship between users on a shared file system like UNIX.  Your model must accommodate the following:  Each user has individual rights and group rights that will both depend upon which network they log on to. Do not attempt to model the file system itself, but users, their rights and group rights.  Your model should not model a person logging onto a network, but what should be in place to allow them to log on.

  4. Draw a class diagram (schema) of the relationship between customers, rooms, room types and reservations in a hotel booking system.  When customers request a room on a particular day/period they are asked what type of room they want.  When they agree on the room type they are assigned a room reservation number.  When they check into the hotel, they are allocated a room.

  5. Model the relationships between the following banking elements.  A bank has a number of customers each having one or more accounts.  Each account may have a card or an account book, but never the two.  Over time an account may have several cards or account books issued.  A record of each card and account book is maintained.  Each time an operation is performed on an account, it results in a transaction being created against that account.  The transaction is unique to that account.  An account may be shared by several customers, but one of them must be the primary owner of that account.  If the account is card based, each customer will have one and only one card each.  If the account is account book based, there will be one account book shared amongst all the customers of that account.

  6. Draw a class diagram (schema) that reflects how files and directories are related to each other.  Keep you model simple and only show what the user sees, not the internal structure used by the OS, and avoid modelling links.

  7. Update your model in question 6, to show the relationship between files, directories and the file and directory name.

  8. Draw a class diagram (schema) that shows the relationship between the objects within a computer network.  The network is constructed as follows:

    1. The network is made up of many computers that can be brought up/down individually or in one go via the network server itself.  The order of the computers is predefined to the network.

    2. The network comprises of one or two hubs.  If both are present, one will act as a backup.  The hubs (when both present) will be connected to one another.

    3. Each computer communicates with other computers via a single hub at any to time and not directly

    4. Each computer/hub connection may be at a different rate and brought up and down without bringing the computers up and down.  A computer/network connection may be brought up and down without affecting the other computers on the network

    5. Each computer is known to the hub via an identifier

  9. Draw a class diagram (schema) expressing the relationship between a train, locomotive and its cars.  Trains are either passenger trains or freight trains and each will be made up of passenger cars or freight cars respectively.  Both passenger and freight trains are made up from a single locomotive of the same type.

  10. Draw a class diagram (schema) of the following: a widget is composed of three parts.  Parts are either metal or plastic.  The parts supplier, are set up to provide exclusively metal parts or plastic parts.  Each widget is made from the parts of a single supplier.

  11. A mathematical expression is made up of a two terms and an operator e.g. +, -, / * etc.  So 3+c, A, 33, 3/a+7 etc, are all examples of mathematical expressions.  Draw a class diagram that expresses the relationship between the following terms; constants (e.g. 4, 56, ‘c’), variables (e.g. a, b, t) and complex expressions (e.g. 2+3, s + 4, v /56), and the operator(s) that bind them together.  How would you modify your diagram to use the unary operator e.g. –7, -b, -3 * v etc.