Transcript
Family Name:. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Other Names: . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ID Number: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Model Solutions ENGR 110: Test 2 24 Sept, 2015 Instructions • Time allowed: 50 minutes . • Closed Book. • Answer all the questions. There are 50 marks in total. • Write your answers in the boxes in this test paper and hand in all sheets. • If you think some question is unclear, ask for clarification. • This test contributes 10% of your final grade • You may use paper translation dictionaries, and calculators. • You may write notes and working on this paper, but make sure your answers are clear.
Questions
Marks
1. Activity Diagrams
[12]
2. Writing Use Case Bodies
[12]
3. Class Diagrams: Associations
[4]
4. Designing Class Diagrams
[12]
5. Designing a FSM Controller
[10] TOTAL:
The following description and use-case diagram for a Medical Lab System is background for questions 1 and 2.
A Medical Lab System A company wants you to produce a program to go with its culture machine which can control and monitor 2000 individual cultures for medical labs. When a medical technician wants to put in a new culture to the machine, the program should specify which capsule in the machine should be used, and set up the machine correctly. The details are stored in the database which is part of the system. When a culture is complete, the technician uses the program to record when they remove the culture from the machine, and the program should check the machine to ensure that the capsule is now empty. The program should allow a technician to look up all the current cultures of a given patient. Finally, it should allow the technician to get a report on the database details for the culture in a capsule, along with an image of the current state of the culture in the capsule (as long as there is a culture).
Put in new culture
Remove Culture
Look Up Patient
Technician
ENGR 110 (Terms Test 2)
seco
ndary
secondary
ry
a ond c e s
Get Report
Page 2 of ??
<
> Culture Machine
Student ID: . . . . . . . . . . . . . . . . . . . . . . .
SPARE PAGE
ENGR 110 (Terms Test 2)
Page 3 of ??
[12 marks]
Question 1. Activity Diagrams [This question refers to the Medical Lab system described on page 2.]
Convert the following use case body into an activity diagram, making sure to clearly label the error and alternate sequences. You may label the boxes using just the bold words in the steps if you wish. Use case: Add New Culture Actors: Technician (primary), Machine (secondary) Actions of actors Actions of system M.1. Technician requests capsule num- M.2. System searches database for capber sule that should be empty M.3. System checks with Machine that capsule is actually empty M.4. Machine reports capsule is empty M.5. System asks for details of patient etc M.6. Technician enters patient details M.7. System prints capsule number and instructions. Alternative scenario A1: Selected capsule is not empty. The A1 scenario starts after step M.3 of the main success scenario Actions of actors Actions of system A.1. Machine reports that capsule is A.2. System updates database full A.3. Go to M.2 Error scenario E1: There are no empty capsules The E1 scenario starts after step M.2 of the main success scenario Actions of actors Actions of system E.1. System finds capsules are all full E.2. System reports that machine is full. Use Case fails.
(Question 1 continued on next page) ENGR 110 (Terms Test 2)
Page 4 of ??
Student ID: . . . . . . . . . . . . . . . . . . . . . . .
(Question 1 continued)
ENGR 110 (Terms Test 2)
Page 5 of ??
[12 marks]
Question 2. Use Case Bodies
Consider the use case Get Report for the Medical Lab System. On the facing page, write the use case body for the main success scenario, and for one error scenario (where the specified capsule is empty). The relevant description is repeated here from page 2: ... Finally, it should allow the technician to get a report on the database details for the culture in a capsule, along with an image of the current state of the culture in the capsule (as long as there is a culture).
(Question 2 continued on next page) ENGR 110 (Terms Test 2)
Page 6 of ??
Student ID: . . . . . . . . . . . . . . . . . . . . . . .
(Question 2 continued)
Use case: Get Report Actors: Technician (primary), Culture Machine (secondary) Actions of actors Actions of system 1. Customer enters capsule 2. System retrieves database number details for capsule 3. System checks with Culture Machine that capsule contains a culture 4. Culture Machine reports that 5. System requests image from capsule is not empty Culture Machine 6. Culture Machine returns im- 7. System reports details and age of capsule displays image Error scenario E1: Empty Capsule The E1 scenario starts at point 4 of the main success scenario Actions of actors Actions of system 4. Culture Machine reports that 5. System reports empty capcapsule is empty sule. Use Case fails.
ENGR 110 (Terms Test 2)
Page 7 of ??
SPARE PAGE FOR EXTRA ANSWERS Cross out rough working that you do not want marked. Specify the question number for work that you do want marked.
ENGR 110 (Terms Test 2)
Page 8 of ??
Student ID: . . . . . . . . . . . . . . . . . . . . . . .
[4 marks]
Question 3. Class Diagrams: Associations
Consider the following fragment of a class diagram with two classes and an association: PhDStudent ThesisTitle
Researcher Students 0..*
Supervisors 1..3
ResearchArea
Explain what the multiplicities of the association mean in terms of individual PhDStudent objects and individual Researcher objects.
Every PhDStudent object has at least 1 and at most 3 Researchers as supervisors. A Researcher may have any number of PhDStudents, including none.
ENGR 110 (Terms Test 2)
Page 9 of ??
[12 marks]
Question 4. Designing Class Diagrams
Draw a class diagram with at least three classes for the following Puzzle/Adventure game in which players search a network of caves to find items that will let them escape from the cave system. Your diagram should include associations, attributes and operations for each class. • Each cave is identified by the colour of the jewel in its roof. • Every cave has a set of tunnels that connect to other caves • Caves may contain items that players can pick up. Each item has a description. • The player has a pack where they can store up to 10 items that they pick up. • When the player moves into a cave, the game will list all the items in the cave. • The player can list the names of the items in their pack. • The player has a health level. Note: For the game to be interesting, there would need to be additional complications, but you do not need to invent them—your class diagram only needs to cover the details given above.
(Question 4 continued on next page) ENGR 110 (Terms Test 2)
Page 10 of ??
Student ID: . . . . . . . . . . . . . . . . . . . . . . .
(Question 4 continued)
ENGR 110 (Terms Test 2)
Page 11 of ??
[10 marks]
Question 5. Finite State Automata
On the facing page, draw the design of an event-based FSM controller for a handheld blender. The blender has a motor, two buttons—up and down— and a timer. The blender should have three modes—off, half and full. Pressing the up button should change the blender from off to half mode, or from half mode to full mode. Pressing the down button should do the opposite. When the blender is in half mode, the motor should be set to low speed. When the blender changes to full mode, the motor should be set to high speed, except that the motor will overheat if it is on high speed for too long. Therefore, when the blender is in full mode, the motor should cycle between being on high speed for 120 seconds, and being on low speed for 20 seconds. The blender sends three sensor signals to the controller: • up (the user pressed the up button), • down, (the user pressed the down button) and • timerExpired. The controller can perform four actions on the blender: • off • low speed • high speed, and • setTimer(n) (where n is the number of seconds) In your design, you may put the actions on the transitions or the states.
(Question 5 continued on next page) ENGR 110 (Terms Test 2)
Page 12 of ??
Student ID: . . . . . . . . . . . . . . . . . . . . . . .
(Question 5 continued)
*************** ENGR 110 (Terms Test 2)
Page 13 of ??
SPARE PAGE FOR EXTRA ANSWERS Cross out rough working that you do not want marked. Specify the question number for work that you do want marked.
ENGR 110 (Terms Test 2)
Page 14 of ??
Student ID: . . . . . . . . . . . . . . . . . . . . . . .
SPARE PAGE FOR EXTRA ANSWERS Cross out rough working that you do not want marked. Specify the question number for work that you do want marked.
ENGR 110 (Terms Test 2)
Page 15 of ??