Name ________Solution_________________ Student Originated Software OOAD Midterm In Class – Fall 2005 You have 50 minutes to complete this exam. Please answer all questions in the space provided. Because of a glitch in EU-Rent’s file server, many of the analysis and design documents for the system have been lost. You have been assigned to code the ReceiveVehicle Use Case, for which there are two extant documents: 1) Some User Interview Notes recorded by the systems analyst of update events that might impact the system (directly below), and 2) a sequence diagram (on the last page of this exam). Your job is to read these documents, answer the questions below, and reproduce the system documentation you will need to code your piece, as per questions 1 through xx. User Interview Notes: To begin with, a vehicle is received at a rental branch, and a record of it is maintained in the system until the vehicle is written off. During its life, it may be taken out of the rental branch’s stock (for example, while it is on contract to a customer), but it is still considered to be owned by the branch. During the vehicle’s life it may be transferred between rental branches, which effectively changes the vehicle’s branch ‘ownership’. A vehicle may be transferred to another rental branch at any time it is not on a contract.
1.
Circle two words in the above narrative that suggest to you which domain classes should be implemented prior to your coding of the ReceiveVehicle use case.
2. In the space below, and using the attached sequence diagram, list the classes and associated operations for each class implied by the ReceiveVehicle sequence diagram. Indicate whether each class is a boundary, control, or domain class. In the list below, prefixes are used to indicate the ‘type’ of a class. • UI_ = Boundary class • CTL_ = Control class • None = domain class UI_ReceiveVehicle (0 operation) CTL_ ReceiveVehicle (1 operation) receiveVehicle (branch-oid, vehicle-idNbr, rental-price) Vehicle (5 operations) receiveVehicle (branch-oid, vehicle-idNbr, rental-price) setIDNbr (vehicle-idNbr) setStandardRentalPrice (rental-price) assignVehicle (branch-oid) gainRentalBranchLink (branch-oid) RentalBranch (4 operations) assignVehicle (my-oid ) GainVehicleLink (vehicle-oid) IncrementVehiclesOwned ( ) IncrementVehiclesInStock ( ) 3. In the space provided on the following page, draw the class diagram implied by the sequence diagram. Include attributes, relationships, and cardinality, Give only attributes on the class diagram. Do not include anything not directly implied by the attached sequence diagram! 1 of 3
rev. 8/20/2009
Name ________Solution_________________ 4. In the space provided on the following page, mock up a UI implied by the sequence diagram. 5. (optional) The author of the sequence diagram had never themselves coded an application in an OO programming language, but they had worked in an object-oriented database. What do you think they meant by including “oid”s in messages on the sequence diagram? Suggest alternate signatures for these messages: • • • • •
everywhere change: receiveVehicle (branch-oid, vehicle-idNbr, rental-price). replace branch-oid with a branch object, myBranch. This assumes that the UI has a search on AllRentalBranches according to some identifier (like id or name) gainRentalBranchLink (branch-oid). This operation is probably not necessary, since the branch object is sent as a parameter to the receiveVehicle operation. assignVehicle (branch-oid) should set MyBranch (class variable) to myBranch (parameter). assignVehicle (my-oid) – this operation probably adds this vehicle to the class variable that holds all vehicles. Vehicle sends itself to the class operation. GainVehicleLink (vehicle-oid) -- the sender of the message (aVehicle) sends itself as a parameter, so that the RentalBranch need not gain a vehicle link.
Class Diagram goes here: Vehicle Vehicle-idNbr StandardRentalPrice MyBranch Class: AllVehicles
1..1 1..m
UI_ReceiveVehicle 1..1 ABranch Vehicle-ID Rental-Price
RentalBranch Name RentalBranch-id MyVehicles NVehiclesInStock Class: AllRentalBranches NVehiclesOwned
CTL_ReceiveVehicle ABranch Vehicle-ID Rental-Price
2 of 3
rev. 8/20/2009
Name ________Solution_________________
ReceiveVehicle UI goes here:
Receive_Vehicle Vehicle Received at Branch: Vehicle ID: Suggested Rental Price: Receive_Vehicle
3 of 3
Cancel
rev. 8/20/2009