Modular HND Scheme Systems Analysis And Design WorkbookANSWER POINTERS
Sample Solutions to Exercises
10 (a)
CASE
mark1 = pass AND mark2 = pass : grade = merit
mark1 = fail AND mark2 = pass: grade = pass
mark2 = fail: grade = fail
ENDCASE
10 (b)
IF cargo = containerised
IF cargo = non-fragile
charge = £15
ELSE (cargo = fragile)
charge = £25
ENDIF
ELSE (cargo = non-containerised)
IF cargo = non-fragile
charge = £35
ELSE (cargo = fragile)
charge = £45
ENDIF
ENDIF
10 (c)
OPEN radiations
SET highest = 0
SET lowest = 400
REPEAT
READ next level
IF level > = highest
SET highest = level
ELSE (level < highest)
**do nothing
ENDIF
IF level < = lowest
SET lowest = level
ELSE (level > lowest)
**do nothing
ENDIF
UNTIL EOF radiations
CLOSE radiations
SET maxMin.high = highest
SET maxMin.low = lowest
10 (d)
Data Structures:
Data Elements
level= integer**[0..400]
high= integer**[0..400]
low= integer**[0..400]
Data Stores:
Name:1 radiations
Description:**the levels of radiation given off by a chemical reaction
Content:= {level}
Inputs:**not available
Outputs:radiations to process 1
vol:**not available
status:electronic file
Data Flows:
Name:radiations
Description:**the content of the store radiations
Content:= {level}
Source:data store 1
Destination:process 1
vol:**not available
status:binary
Name:maxMin
Description:**the high and low levels of radiation in store 1 ‘radiations’
Content:= high+low
Source:process 1
Destination:terminator a ‘Screen’
vol:**not available
Status:binary
Processes:
Name:report radiation readings
Description:**to find the highest and lowest values in store 1 ‘radiations’
Data Inputs:flow radiations from store 1 ‘radiations’
Data Outputs:flow maxMin to terminator a ‘device’
Local Variables:highest = integer
lowest = integer
Mini-Spec:see 10 (c)
10 (e) Night Out Example
Rewrite the following narrative description of a night out in structured English.
When you go to the bar, you may want 4 cokes, you may want 4 pints, and/or you may want 4 whiskies. After 4 pints you will be drunk, after 4 whiskies very drunk, after 4 of each paralytic.
Terms already defined in the data dictionary include: Drinker, Drinks, Cokes, Pints, Whiskies, Drunk, Very-Drunk, Sober, Paralytic.
Do Night-Out
Night-Out
IF Drinks = Pints
IF Drinks = Whiskies (Pints + Whiskies)
Drinker = Paralytic
ELSE (Pints, no Whiskies)
Drinker = Drunk
END IF
ELSE (No Pints)
IF Whiskies
Drinker = Very-Drunk
ELSE (no Pints, no Whiskies)
Drinker = Sober
END IF
END IF
10 (f)Carpet Fitting Example
Describe the following process to calculate a carpet fitting charge using Structured English.
For the purpose of determining delivery charges, customers are divided into 2 categories: those who are account holders and those who are not. If an account holder buys a carpet costing less than £1,000, the fitting charge to be added to the cost of the carpet is £1.25 per square metre. However, if the carpet costs £1,000 or more, the fitting charge is £0.75 per square metre. If a customer is not an account holder and the carpet cost is less than £1,000, the fitting charge is £1.65 per square metre. For a carpet costing £1,000 or more, however, the fitting charge is £1.15 per square metre.
Do Calculate-Carpet-Fitting-Charge
Calculate-Carpet-Fitting-Charge
IF Customer = Account-Holder
IF Carpet-Cost < £1,000
Fitting-Charge = £1.25 per square metre
ELSE (Carpet-Cost >= £1,000)
Fitting-Charge = £0.75 per square metre
END IF
ELSE (CustomerAccount-Holder)
IF Carpet-Cost < £1,000
Fitting-Charge = £1.65 per square metre
ELSE (Carpet-Cost >= £1,000)
Fitting-Charge = £1.15 per square metre
END IF
END IF
1
SAD : ANSWER POINTERS & MODEL SOLUTIONS