Sunday, February 17, 2013

Decision table

Decision Table
A decision table is a graphical method for explaining the logic of making decision in tabular format.
It is a set of conditions + set of actions and different combinations of decisions.
“It is a matrix representation of logic of decisions which specify the possible conditions for decision and resulting actions.”

The decision table is divided into two parts:
1.    Condition
2.    Action

1.    Condition:
The condition part specifies all conditions that are applied to the inputted data. It is also divided into two parts à
                                                       i.            Condition Stub:-
It describes the conditions that exist in the program logic.
                                                     ii.            Condition Entry:-
It provides answers to questions asked in the condition asked in the condition term.

2.    Action:
The action part is subdivided into two parts à
                                                       i.            Action Stub:-
It describes the action to be taken to meet each condition.
                                                     ii.            Action Entry:-
It describes the appropriate action resulting from the answer to the condition in condition entry.

Format:
Table Heading
Decision Rule
Condition Stub
Condition Entry
Action Stub
Action Entry

Advantages of Decision Table
1.    It provides compact representation of decision making process.
2.    It is easier to understand particular path.
3.    It can be changed according to situation.
4.    These are best suited for calculating discounts, commissions or inventory control procedures.
5.    The structure of decision table promotes a logically complete and consistent problem definition.

Disadvantages of Decision Table
1.    It cannot express the complete sequence of operations to solve a problem therefore it may be difficult for the programmer to translate decision table into program.
2.    If there are too many alternatives, it is difficult to list in decision table.
3.    It does not show the flow of logic for the solution to a given problem.

Q:  An insurance company uses the following rule to determine the eligibility of a driver for insurance.
          The driver will be insured if:-
1.    The driver lives in the city with population less than 5000 and he is married man.
2.    The driver lives in the city with population less than 5000 and he is married and age is over 30 years old.
3.    The driver lives in the city with population is 5000 or more and it is married female.
4.    The driver is male over 30.
5.    The driver is married and under 30.
Condition
Rule1
Rule2
Rule3
Rule4
Rule5
Else
Lives in city population<5000
Y
Y
N
-
-
-
Male
Y
-
N
Y
-
-
Married
Y
Y
Y
-
Y
-
Age>30
-
Y
-
Y
N
-
Action
Rule1
Rule2
Rule3
Rule4
Rule5
Else
Insured
Y
Y
Y
Y
Y

Uninsured





Y








Q: Study following conditions and draw a decision table:-
1.    If product code=A
And customer type=1
And the order amount<=700
Then 5% discount allowed
2.    If product code=A
And customer type=2
And the order amount<=700
Then 7.5% discount allowed
3.    If product code=A
And customer type=1
And the order amount>=700
Then 7.5% discount allowed
4.    If product code=A
And customer type=2
And the order amount>700
Then 10% discount allowed
5.    A flat discount of 5% on product code=B regardless of customer type and the order amount
Condition
Rule1
Rule2
Rule3
Rule4
Rule5
Else
Product code=A
Y
Y
Y
Y
N
-
Customer type=1
Y
N
Y
N
-
-
Order amount<=700
Y
Y
N
N
-
-
Action
Rule1
Rule2
Rule3
Rule4
Rule5
Else
Discount 5%
Y



Y

Discount 7.5%

Y
Y



Discount 10%



Y


No Discount





Y











Q: Draw a decision table for a company with three person A,B,C whose share in the company are 50%,20%,30% sequentially. Any low arises in the company will be passed if it is supported by share holders and whose share holding exceed 2/3 of the total shares.

Condition
Rule1
Rule2
Else
A 50%
Y
Y
-
B 20%
N
Y
-
C 30%
Y
N
-
Action
Rule1
Rule2
Else
Low Passed
Y
Y

Low Rejected


N


Q: A Co-operating bank xyz granted loan under following conditions draw decision table and tree-
1.    If a customer has a account with the bank and has no loan outstanding (no dues), loan will be granted.
2.    If a customer has an account is outstanding from previous loan, loan will be granted if special management approval is obtained.
3.    Reject loan application in all other cases.
Condition
Rule1
Rule2
Else
Customer has Account
Y
Y
-
No Out-standing loan  amount
Y
N
-
Special Management Approval
-
Y
-
Action
Rule1
Rule2
Else
Loan Application Accept
Y
Y

Loan Application Reject


Y



0 comments:

Post a Comment

Powered by Blogger.