91.3913 Assignment 4 Answers April 5, 2002

5
91.3913 Assignment 4 Answers April 5, 2002 1. Cyclomatic complexity Either of these two representations is correct (simple sequences can be collapsed to a single node). CC = #edges - #nodes +2 = 6 - 6 + 2 = 2 CC = #edges - #nodes +2 = 4 - 4 + 2 = 2 4 marks Total of 27 marks

description

91.3913 Assignment 4 Answers April 5, 2002. Total of 27 marks. 1. Cyclomatic complexity. 4 marks. Either of these two representations is correct (simple sequences can be collapsed to a single node). CC = #edges - #nodes +2 =6 - 6 + 2 =2 - PowerPoint PPT Presentation

Transcript of 91.3913 Assignment 4 Answers April 5, 2002

Page 1: 91.3913         Assignment 4         Answers         April 5, 2002

91.3913 Assignment 4 Answers April 5, 2002

1. Cyclomatic complexity

Either of these two representations is correct(simple sequences can be collapsed to a single node).CC = #edges - #nodes +2 = 6 - 6 + 2

= 2CC = #edges - #nodes +2 = 4 - 4 + 2

= 2

4 marks

Total of 27 marks

Page 2: 91.3913         Assignment 4         Answers         April 5, 2002

91.3913 Assignment 4 Answers April 5, 2002

2. WMC, using technique a), is the number of methods in a class:

SalesLineItem 2ProductSpecification 4Sale 6

3. LCOM, using technique a)for each attribute calculate: #methods using the class

number of attributesthen calculate the average of those values; convert the average to a percentage; subtract that from 100:SalesLineItem (two methods and two attributes)average of 2/2 and 2/2 is 1 ==> 100% ==> 100-100 = 0ProductSpecification (four methods and three attributes)average of 2/4, 2/4, and 2/4 is 0.5 ==> 50% ==> 100-50 = 50

3 marks

4 marks

Page 3: 91.3913         Assignment 4         Answers         April 5, 2002

91.3913 Assignment 4 Answers April 5, 2002

4. An O-R mapping:

Class Maps to Relation

Sale

SalesLineItem

Association Maps to Relation/FKey

contains FK in SalesLineItem (refers to Sale)

describes FK in SalesLineItem (refers to ProductSpecification)

ProductSpecification ProductSpecification

SalesLineItem

Sale

16 marks

Page 4: 91.3913         Assignment 4         Answers         April 5, 2002

91.3913 Assignment 4 Answers April 5, 2002

Relational Schema

Sale

ProductSpecification

SalesLineItem

date isComplete ...

quantity sOID

description price itemID

sOID

slOID

pOID

pOID

Page 5: 91.3913         Assignment 4         Answers         April 5, 2002

91.3913 Assignment 4 Answers April 5, 2002

Rows: Sale

ProductSpecification

SalesLineItem

date isComplete ...

quantity sOID

description price itemID

sOID

slOID

pOID

pOID

4/5/2002 false ...111

1 111667 195

2 111875 195

Product 1 $2..50 1195