THE UNIVERSITY OF HONG KONG
FACULTY OF ENGINEERING
DEP ARTMENT OF COMPUTER SCIENCE
COMP3297/CSIS0297 Introduction to Software Engineering
Date: 13 May 2014 Time: 9:30 a.m.-12:30 p.m.
Only approved calculators as announced by the Examinations Secretary can be used in this examination. It is the candidates’ responsibility to ensure that their calculator operates satisfactorily, and candidates must record the name and type of the calculator used on the front page of the examination script.
Answer ALL questions. The weights of individual questions are different, as specified at the beginning of each question.
It is important to show your understanding of the software engineering process in the answers.
If you need to make any (reasonable) assumptions on the questions, please state them in your
answers.
You may use pencils to present your specifications or designs.
P.1 ofS
1. (40 per cent)
There are many shops in Sham Shui Po that provide maintenance services to popular computers. However, their services are far from satisfactory. Apricot Store proposes to attract customers for good maintenance services at a reasonable price. The following are the user requirements.
• Customers may make requests for maintenance services through terminals at the stores. They may specify no more than 10 services for any computer. This is done by first keying in the Apricot id. If the number is valid, details of the computer (such as the model, customer information, and date of original purchase) are displayed for confirmation. The customer then keys in the code of each maintenance service requested. The system displays the name of each service and asks for confirmation again.
• If there is an error in the Apricot id or the code of the maintenance service, the system will show an appropriate error message.
• At 6:00 p.m. every day, the system produces statistical summaries of the maintenance services requested. The summaries are sent automatically by emails to the managers of the relevant Apricot stores.
You are invited to:
(a) conduct object-oriented analysis according to the user requirements, and (b) hence, conduct object-oriented design for the system.
There is no need to draw sequence diagrams or state machines for this question.
P. 2 of 5
2. (25percent)
(a) Highlight the similarities and differences between sequence diagrams and state machines in
UML.
(b) Cafe Lohas is a new coffee shop. It proposes an automatic machine that enables staff members to make tea or coffee very easily. The automatic machine contains two software components, namely, a front-end interface and a machine controller. The front-end interface is linked to a display panel with a touch button, whereas the machine controller is linked to a traditional tea-and-coffee machine. The following are the user requirements.
The operations of the touch button are defined as follows:
• Continued touch: Touch the button for at least 1 second.
Coffee IButton I
• Single click: Touch the button for less than 1 second and then lift the finger for at least 1 second.
• Double click: Touch the button for less than 1 second, lift the finger for less than 1 second, touch the button again for less than 1 second, and then lift the finger.
• Cancel: Touch the button for less than 1 second, lift the finger for less than 1 second, and then touch button again for more than 1 second.
The operations of the automatic machine are as follows:
(i) When the automatic machine is turned on, show “coffee” in the display panel.
(ii) Whenever the button is single-clicked, if the display panel shows “coffee”, then change it
to “tea”.
(iii) Whenever the button is single-clicked, if the display panel shows “tea”, then change it to
“coffee”.
(iv) Whenever the button is continuously touched, add the appropriate drink to the cup according to the display (until the finger is lifted).
(v) Whenever the button is double-clicked, move the hot cup from the machine to the counter.
(vi) Whenever a staff member uses the button to indicate a “cancel” operation, stop moving the cup immediately. This will prevent any serious accident.
Conduct dynamic modelling for the above system. There is no need to do use case modelling or object modelling for this question.
P. 3 of 5
3. (20percent)
Given non-negative integers n and r, the following program computes the combination nc, using
theformula”C,=n* (n-1)* … *(r+ l)l(r* (r-1) *… * 1).
1:
2: 3: 4: 5: 6: 7: 8: 9:
10: 11: 12: 13: 14:
15:
#include
int n, r, i, combination;
cout << "This program computes the combination nCr." << endl;
cout << "Please enter n: "; cin >> n;
cout << "Please enter r: "; cin>>r;
if(n==O) n = 1;
i=O; if(r==O)
r=2; IIItshouldbe”r=1;” combination = 1;
while (i < r) [
combination = combination * (n - i) I (i + 1); i++;
cout << "nCr = " << combination « endl;
(a) Using examples of test cases for the above program, explain and illustrate the common coverage criteria in control flow testing. Hence, discuss any problems you may encouuter in the application of control flow testing coverage criteria to this program.
(b) Using examples of test cases with respect to the program variable i, explain and illustrate the common coverage criteria in data flow testing.
(c) Based on the examples in (a) and (b), discuss the notion of subsumption relationships. Hence, discuss the advantage(s) of data flow testing over control flow testing.
P. 4 of 5
4. (15percent)
A 59-year-old woman died on 21 January 2014 after she had been given a heart transplant of the wrong blood type at Queen Mary Hospital. The hospital decides to improve its database. The following are requirements of different users. Conduct entity modelling using bubble charts, and hence prepare a conventional enterprise database model.
(i)
(ii)
Ward Allocation
A Ward# uniquely identifies the Capacity. The Ward# also identifies a group of Patient#(s). Each Patient# uniquely identifies his/her Name and Doctor#.
Diagnostic Test Request
A Patient# uniquely identifies his/her Name and Symptom. The Patient# also identifies a group of TestType(s). Each TestType for the patient identifies the Date.
(iii) Diagnostic Test Result
A TestType uniquely identifies the Equipment and Material. The TestType also identifies a
groupofPatient#(s). EachPatient#uniquelyidentifieshis/herName. (iv) Nurse Supervision
A Doctor# uniquely identifies his/her Name and the SupervisingDoctor#, which further identifies his/her Name and the SupervisingDoctor#, and so on. The Doctor# also identifies a group of SubordinateDoctor#(s), each of which further identifies a group of SubordinateDoctor#(s), and so on.
END OF PAPER
P. 5 of 5