COMP2606: Software Engineering 1 Tutorial # 7 Solutions
COMP2606: Software Engineering 1 Tutorial # 7 Solutions
Tutorial # 7 Solutions
1. A vending machine sells small, packaged, ready to eat items (chocolate bars, cookies, candies, etc.).
Each item has a price and a name. A customer can buy an item, using a smart card (issued by the
vending machine company) to pay for it. No other payment forms (i.e. cash, credit card) are allowed.
The smart card records on it the amount of money available. The functions supported by the system
are: Sell an item (choose from a list of items, pay item, distribute item) Recharge the machine Set up
the machine (define items sold and price of items) Monitor the machine (number of items sold, number
of items sold per type, total revenue) The system can be used by a customer, a maintenance employee
(who recharges items in the machines), an administrator (who sets up the machine).
a. Model with a class diagram the following System: Vending Machine.
b. Enrich the model of the Vending Machine with a sequence diagram describing a successful sales
procedure
2. A university offers degrees to students. The university consists of faculties each of which consists of
one or more departments. Each degree is administered by a single department. Each student is studying
towards a single degree. Each degree requires one to 20 courses. A student enrolls in 1-5 courses (per
term.) A course can be either graduate or undergraduate, but not both. Likewise, students are graduates
or undergraduates but not both.
Draw a class diagrams which represents the generic objects and relationships described above. Make
sure to specify multiplicities for all associations shown in your diagrams.
3. To take CSC340, a student must go through the following process. When the instructor posts
assignment 1, each student must form a team, do the assignment and hand it in. When assignment 2 is
posted, each student works on it with her team; in parallel, when the midterm is made available, each
student writes it. After both assignment 2 and the midterm are done with, each student waits for
assignment 3, and when it is available, does it with her team.
In particular, students are members of teams. Each team has 2 or 3 members. Each team completes 0
to 3 assignments. Each student takes exactly one midterm test. Computer Science students have a single
account on the CSF facility, while each engineering student has an account on the Engineering facility.
Each assignment and midterm is assigned a mark.
Draw a class diagram (with attributes, where appropriate) that describes entities and relationship
relevant to the process described.
4. Blockbuster Video managers want to improve the way they maintain information about their customers.
In particular, they want to create an information system (“VideoSystem”) able to perform the following
functions:
Given the id of a customer, find his/her name, address and phone number;
Given the id of a customer, determine if he/she has any outstanding videos (rented but not returned);
1
COMP2606: Software Engineering 1
Tutorial # 7 Solutions
Find out how many rental items are currently rented; this operation is performed very frequently!
Return a rental item to the store; when a rental item is returned, it is inspected and its status is
updated accordingly;
Retrieve information about a particular rental item, given its id (barcode);
Given a customer id and barcode, find the customer with the given id, find the rental item with the
given barcode; if both exist (and the rental item is rentable) then rent the item to the customer;
List all the rental items currently rented/owned by a specific customer;
For a specific rental item, (if it is currently rented/owned) identify the customer who is renting it;
In general, the VideoSystem will need to keep track of a collection of customers and a collection of
rental items, as well as relationships between them. Here are additional details on how Blockbuster
Video conducts its business:
A customer can rent (possibly many) items.
There are two types of rental items: DVDs and video cassettes (“videos”). Customers rent either of
these two types of rental items. A rental item has a barcode and a movie name. The status of a rental
item is either rented, available, expired (if it has been rented a maximum number of times),
damaged or sold (if it was sold to a customer). If its rented, a rental items due date specifies the
date that the item should be returned. Each video cassette has a lifespan (a maximum number of
times that it can be rented). A newly created video cassette has a lifespan of 50 rentals. DVDs have
unlimited lifespans. A non-damaged, available rental item can either be rented or sold to a customer.
An expired rental item can only be sold. You can ask for the status of a rental item. All rental items
can be rented (by a customer) and returned. When an item is returned, the clerk who handles the
transaction labels it “OK” or "damaged" depending on its status. Because of the differences
between DVDs and video cassettes, some of these operations (rent, return etc.) have DVD or video
cassette-specific components.
Customers can be retrieved by their id, rental items by their barcode.
Draw a class diagram which represents the information handled by VideoSystem. Your class diagram
should concisely and simply reflect the relationships described above. Make appropriate use of UML
class diagram features: relationship (association, generalization, aggregation, multiplicity, etc,),
visibility (public, private, static), attributes (including type), and operations (including signatures.)