Structured English specification.
Structured English specification
PROCESS SPECIFICATION
Once a DFD is obtained the next step is to precisely specify the process. Structured English, Decision tables and Decision Trees are used to describe processes. Decision tables are used when the process is logically complex involving large number of conditions and alternate solutions. Decision trees are used when conditions to be tested must follow a strict time sequence.
STRUCTURED ENGLISH
Structured English is similar to a programming language such as Pascal. It does not have strict syntax rules as in programming languages as the intention is only to give precise description of a process. The structured English description should be understandable to the user.
DECISION TABLE-EXAMPLE
Same structured Englis edure given as decision table
DECISION TABLE-EXPLANATION
• Conditions are questions to be asked
• ‘Y’ is yes,’N’ is no & ‘-’ is irrelevant
• A ‘X’ against the action says the action must be taken
• A ‘-’ against the action says the action need not be taken
Rule 2 in decision table DISCOUNT states:
if no advance payment and purchase amount >=10000
and regular customer then give 5% discount
In Structured English, imperative sentences, actions to be performed should be precise and quantified
Good Example: Give discount of 20%
Bad Example: Give substantial discount
The operators and keywords in Structured English are as follows:
until, while, do, case, for, search, retrieve, read, write Delimiters – {, }, end, end if, end for The structured English procedure given above is expressed as a Decision tree below
STRUCTURED ENGLISH-DECISION STRUCTURES
If condition then
{ Group of statements }
else
{ Group of statements }
end if
Example: if(balance in account >= min.balance)
then honor request
else reject request
end if
STRUCTURED ENGLISH-CASE STATEMENT
Case (variable)
Variable = P: { statements for alternative P}
Variable = Q: { statements for alternative Q}
Variable = R: { statements for alternative R}
None of the above: { statements for default case}
end case
Example : Case(product code)
product code =1 : discount= 5%
product code =2 : discount =7%
None of the above : discount=0
end case
STRUCTURED ENGLISH-REPETITION STRUCTURE
for index = initial to final do
{ statements in loop }
end for
Example : Total =0
for subject =1 to subject =5 do
total marks=total marks +marks(subject)
write roll no,total marks
end for
STRUCTURED ENGLISH-WHILE LOOP
while condition do
{ statements in loop }
end while
Example : while there are student records left do
read student record
compute total marks
find class
write total marks, class, roll no
end while
EXAMPLE
Comments
Post a Comment