0% found this document useful (0 votes)
3 views

Processing Logic - Decision Trees & Graphs

Uploaded by

tulsirathod9102
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Processing Logic - Decision Trees & Graphs

Uploaded by

tulsirathod9102
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Representation of complex processing

logic


Decision trees

Decision tables

44
Decision Trees


Decision trees
− Edges of a decision tree represent conditions
− Leaf nodes represent actions to be performed.

A decision tree gives a graphic view of,
− Logic involved in decision making
− Corresponding actions taken.

45
Example: Library Membership
automation Software (LMS)

A LMS should support following three options:
− New member, Renewal, Cancel membership.


When the new member option is selected,
− The software asks details about the member name,
address, phone number, etc.

If proper information is entered,
− A membership record for the member is created
− A bill is printed for the annual membership charge plus
the security deposit payable.

46
LMS Example (cont.)

If the renewal option is chosen,
− LMS asks the member's name and his membership number

checks whether he is a valid member.
− If the name represents a valid member,

the membership expiry date is updated and the annual
membership bill is printed,

Otherwise, an error message is displayed.

If the cancel membership option is selected and the
name of a valid member is entered,
− The membership is cancelled,
− A cheque for the balance amount due to the member is
printed,
− The membership record is deleted. 47
Decision Tree
- Get details
- Create record
- Print bills
New member
- Get Details
User Renewal - Update record
- Print bills
input
Cancel - Get Details
- Print Cheque
- Delete record
Invalid
option
- Print error message

48
Decision Table


Decision tables specify:
− Which variables are to be tested,
− What actions are to be taken if the conditions are true,
− The order in which decision making is performed.


A decision table shows in a tabular form:
− Processing logic and corresponding actions


Upper rows of the table specify:
− The variables or conditions to be evaluated

Lower rows of the table specify:
− The actions to be taken when the corresponding 49
conditions are satisfied.
Decision Table


In technical terminology,
− a column of the table is called a rule
− A rule implies:

if a condition is true, then execute the
corresponding action.

50
LMS Example – Decision Table


Conditions
Valid selection NO YES YES YES
New member -- YES NO NO
Renewal -- NO YES NO
Cancellation -- NO NO YES

Actions
Display error message
Ask member's name etc.
Build customer record
Generate bill
Ask membership details
Update expiry date
Print cheque
Delete record
51
Compare : Decision Tree vs. Decision Table


Both decision tables and decision trees
− Can represent complex program logic.


Decision trees are easier to read and understand
− When the number of conditions are small.

Decision tables help to look at every possible
combination of conditions.

52

You might also like