You are on page 1of 18

6

Decision Table

LEARNING OBJECTIVES
This Chapter enables the student to obtain knowledge about the following:
The concept of Decision Tables.
Various types of decision tables.
Many practical problems and their corresponding decision tables.

Introduction
A decision table is a table which may accompany a flowchart, defining the possible
contingencies that may be considered within the program and the appropriate course of action
for each contingency.
Decision tables are necessitated by the fact that branches of the flowchart multiply at each
diamond (comparison symbol) and may easily run into scores and even hundreds. If, therefore, the
programmer attempts to draw a flowchart directly, he is liable to miss some of the branches.
A decision table is divided into four parts:
(1) Condition Stub - (which comprehensively lists the comparisons or conditions);
(2) Action Stub- which comprehensively lists the actions to be taken along the various
program branches;
(3) Condition entries - which list in its various columns the possible permutations of answer
to the questions in the conditions stub); and
(4) Action entries - (which lists, in its columns corresponding to the condition entries the
actions contingent upon the set of answers to questions of that column)
A decision table is given below as an example :
Granting Credit Facility R1 R2 R3
Part 1 C1 Credit limit Okay Y N N Part 3
C2 Pay experience Favourable - Y N
Part 2 A1 Allow Credit Facility X X
A2 Reject Order X Part 4

The Institute of Chartered Accountants of India


6.2 Information Technology

There are two conditions: C1 and C2 in this table and two actions: A1 and A2. According to R1
(a set of rules), if there is a Yes to C1 and C2 is to be bypassed, action A1 will be taken, that
is, Allow credit facility. Under R3, Nos to both C1 and C2 requires action A2 to be taken.
With this example, we give below the components of the decision table in more detail.
(a) Condition Statement - Statement which introduce one or more conditions
(i.e., factors to consider in making a decision)
(b) Condition Entries - Entries that complete condition statements.
(c) Action Statements - Statements which introduce one or more actions (i.e., steps to be
taken when a certain combination of conditions exist)
(d) Action Entries - Entries that complete the action statements.
(e) Rules - Unique combinations of conditions and actions to be taken under those
conditions.
(f) Header - Title identifying the table.
(g) Rule Identifiers - Code (R1, R2, R3,) uniquely identifying each rule within a table.
(h) Condition Identifiers - Codes (C1, C2, C3,...) uniquely identifying each condition
statements/entry.
(i) Action Identifiers - Codes (A1, A2, & A3...) uniquely identifying each action statement/
entry
These items are contained within the body of the table which is divided into four major
sections by double or heavy vertical and horizontal lines as in the table above.

6.1 Types of Decision Table


Limited Entry Tables - In a limited entry table the condition and action statements are
complete. The condition and action entries merely define whether or not a condition exists or
an action should be taken. The symbols used in the condition entries are :
Y: Yes, the condition exists
N: No, the condition does not exist.
: Irrelevant, the condition does not apply, or it (or blank) makes no difference whether the
condition exists or not.
The symbols used in the action entries are:
X : Execute the action specified by the (or blank) action statement.
: Do not execute the action specified by the (or blank) action statement.
Extended Entry Table: The condition and action statements in an extended entry table are
not complete, but are completed by the condition and action entries.

The Institute of Chartered Accountants of India


Decision Table 6.3

Example :
Granting Credit Facility R1 R2 R3
C1 Credit Limit OK Not OK Not OK
C2 Pay Experience - Favourable Unfavourable
A1 Credit Facility Allow Allow -
A2 Credit Action - - Reject Order
Mixed Entry Table: The third type of decision table is the mixed entry form which combines
both the limited and extended entry forms. While the limited and extended entry forms can be
mixed within a table, only one form may be used within a condition statement/entry or an
action statement/entry.
Example:
Granting Credit Facility R1 R2 R3
C1 Credit Limit Okay Y N N
C2 Pay Experience - Favourable Unfavourable
A1 Credit Allow Allow -
A2 Reject Order X
A systematic approach to the development of a limited entry decision table is presented below

6.2 Steps In Preparing A Limited Entry Decision Table


1. List conditions and actions.
2. Combine conditions which describe the only two possibilities of a single condition. In other
words, delete conditions which can be derived from the responses of the other conditions.
3. Make yes or no (Y or N) responses and mark actions to be taken for each rule with X.
4. Combine redundant rules to simplify table.
5. Check for completeness.
An example will be used to explain and illustrate the procedure.
6.2.1 Solved Examples
Example 1: A shop owner allows credit facility to his customers if they satisfy any one of the
following conditions:
1. Holding the present job for more than 3 years and residing in the same place for more
than 5 years.
2. Monthly Salary exceeds ` 1500 and holding the present job for more than 3 years.
3. Residing in the same place for more than 5 years and monthly salary exceeds ` 1500.
The facility is rejected for all other customers.

The Institute of Chartered Accountants of India


6.4 Information Technology

Solution: Step 1 is to write down all of the conditions and actions:


Conditions involved in the problems are:
1. Holding the present job for more than 3 years.
2. Holding the present job for 3 years or less than 3 years.
3. Monthly salary exceeds ` 1500.
4. Monthly salary equals ` 1500 or less than ` 1500.
5. Residing in the same place for more than 5 years.
6. Residing in the same place for 5 years or less than 5 years.
Actions involved in the problem are:
1. Allow credit facility.
2. Reject credit facility.
Step 2 is to combine conditions which only describe the two possibilities of a single condition:
Holding the present job for more than 3 years and Holding the present job for 3 years or
less than 3 years can be combined. A single condition holding the present job for more than
3 years can represent both because a No answer means holding the present job for more
than 3 years or less than 3 years. The same reasoning allows the combination of 3 & 4 and
also 5 & 6.
There are thus only three conditions:
1. Holding the present job for more than 3 years.
2. Monthly salary exceeds ` 1500.
3. residing in the same place for more than 5 years.
Step 3 is to prepare the Yes and No responses using Y and N for all possible combinations of
conditions and for each set of conditions, mark the actions to be taken with an X.
No. of rules = 2no of conditions
In the example, there are three conditions, so there will be 23 or 8 rules. The Ys and Ns can
be inserted in any order, but a systematic method will reduce the effort of filling in the table
and reduce the chance of error. Start with the bottom row of the condition entries and fill in the
row starting with Y and then alternating between N and Y. The row above this is filled in by
writing two Ys, two Ns, two Ys etc. The third row from the bottom uses sets of four Ys and
four Ns. This doubling of the sets of Ys and Ns continues until the table is complete. Then
analyse each rule and fill in the action entries. The Figure below shows the completed table at
this stage.

The Institute of Chartered Accountants of India


Decision Table 6.5

Allowing Credit Facility R1 R2 R3 R4 R5 R6 R7 R8


C1 Holding the present job for Y Y Y Y N N N N
more than 3 years
C2 Monthly salary exceeds Y Y N N Y Y N N
` 1500
C3 Residing in the same place Y N Y N Y N Y N
for more than 5 years
A1 Allow credit facility X X X X
A2 Reject credit facility X X X X

Step 4 is to combine rules where there are redundancies:


Two rules can be combined into a single rule if:
(i) all of the conditions except one have the same Y or N (or) condition entries and
(ii) the actions are the same for both.
Rule with impossible combination of condition entries can be combined with any other
rule if
(iii) all of the conditions except one have the same Y or N (or) condition entries.
(see Example 2)
Combine the two rules into one and replace the condition entry of Y and N with a dash
(), which means the condition does not affect the action to be taken. Using this procedure,
rule R1 and R2 can be combined. In other words, if holding the present job for more than 3
years and monthly salary exceeds ` 1,500, then the credit facility is allowed without regard to
the third condition viz. residing in the same place for more than 5 years. Rules R7 & R8 (or R4
& R8) can be combined. The resulting table, after redundancies removed, is shown below :
Allowing Credit Facility R1 R2 R3 R4 R5 R6
C1 Holding the present job for Y Y Y N N N
more than 3 years
C2 Monthly salary exceeds ` Y N N Y Y N
1500
C3 Residing in the same place for Y N Y N
more than 5 year
A1 Allow credit facility X X X
A2 Reject credit facility X X X

Step 5 is to check for completeness of the rules:


(1) Count number of dashes in the condition entries for each rule. The number of rules
represented by each rule is 2m where m is the number of dashes. Where there are no

The Institute of Chartered Accountants of India


6.6 Information Technology

dashes, the number represented is 20 or 1. A single dash means 2 rules have been
combined etc.
(2) Sum the number of rules represented by the different rules as computed above.
(3) Compare the number of rules represented by the reduced table with the number to be
accounted for, which is 2n (n no of conditions) If they are equal (and all other features
are correct), the table is complete.
In the example, rules R1 & R6 have one dash and rules R2, R3, R4 and R5 have no dashes.
The sum of the rules represented by the rules in the reduced table is 2+1+1+1+1+2 which is
equal to 23 or 8.
Therefore, the reduced table is complete.
Example 2: Select the largest of three distinct numbers A,B,C
Solution: Step 1 - Conditions involved in the problem are:
1. A>B
2. A>C
3. B>A
4. B>C
5. C>A
6. C>B
Actions involved in the problem are:
1. A is largest
2. B is largest
3. C is largest
Step 2 - Conditions 1 & 3 can be combined
Conditions 2 & 5 can be combined
Conditions 4 & 6 can be combined
Therefore, there are only three conditions:
1. A>B
2. A>C
3. B>C
Step 3 - No. of rules = 2nd conditions
= 23 = 8

The Institute of Chartered Accountants of India


Decision Table 6.7

Select Largest R1 R2 R3 R4 R5 R6 R7 R8
C1 A>B Y Y Y Y N N N N
C2 A>C Y Y N N Y Y N N
C3 B>C Y N Y N Y N Y N
A1 A is largest X X
A2 B is largest X X
A3 C is largest X X
*R3 and R6 contain impossible combination of condition entries.
Step 4 - R1 & R2 can be combined
R3 & R4 can be combined
R5 & R7 can be combined
R6 & R8 can be combined
Select largest R1 R2 R3 R4
C1 A>B Y Y N N
C2 A>C Y N
C3 B>C Y N
A1 A is largest X
A2 B is largest X
A3 C is largest X X
Step 5 - All the rules in the reduced table have one dash. Therefore, the sum of the rules
represented by rules in the reduced table is 21 + 21 + 21 + 21 which is equal to 23 or 8. No. of
conditions is 3 and hence the No. of rules to be accounted for is 23 or, 8. Therefore the
reduced table is complete.
If problem has many conditions, the decision table may become quite large and difficult to
follow. Since the objective of the table is to show the logic of the procedure as clearly and as
simply as possible, a large, complex table should be avoided. In most cases, a large problem
with many conditions can be subdivided into two or more tables. One or more of the actions of
the first table will specify that the user should proceed to another table to complete the logic.
An example is given to illustrate this use of more than one table.
Example 3: A sales organization is seeking to hire some salesmen and sales-women having
special characteristics. They need only unmarried personnel between the age of 18 and 30. If
male, they want the salesman to be over 5 ft in height but less than 75 Kg. in weight and not
bald. If female, the saleswoman is to be less than 5 ft. in height and less than 55 kg. in
weight and is to have shoulder-length hair.

The Institute of Chartered Accountants of India


6.8 Information Technology

Solution: This problem has nine conditions, which would mean a table with 29 = 522 rules
before reduction. But the problem fits logically into three parts: the overall criteria, male
criteria, and female criteria. This suggests that three decision tables should be used-initial
screening, male selection and female section. The result of this use of three tables is shown
below. All tables have redundancies removed.
Initial screening R1 R2 R3 R4
C1 Unmarried Y Y Y N
C2 Age between 18 & 30 Y Y N
C3 Male Y N
A1 Go to male selection table X
A2 Go to female selection table X
A3 Reject X X
Male selection R1 R2 R3 R4
C1 Over 5 ft. in height Y Y Y N
C2 Less than 75 Kg. in weight Y Y N
C3 Not bald Y N
A1 Hire X
A2 Reject X X X
Female selection R1 R2 R3 R4
C1 Under 5 ft. in height Y Y Y N
C2 Less than 55 kg. in weight Y Y N
C3 Shoulder-length hair Y N
A1 Hire X
A2 Reject X X X
As a reader develops some skill, he may be able to arrive more directly at the final table.
However, the beginner should proceed carefully.
6.2.2 Exercises
1. Analyse the completeness of the following decision table:
Table X R1 R2 R3 R4 R5
C1 Condition A Y N N N N
C2 Condition B Y Y N N N
C3 Condition C N Y N
C4 Condition D N N
A1 Action 1 X X X
A2 Action 2 X X

The Institute of Chartered Accountants of India


Decision Table 6.9

2. Prepare decision table for each of the following.


A cheque is presented at a bank. The cashier has to decide what to do. The rules state that
on presentation of a cheque the cashier is required to ensure that there are sufficient funds in
the account to meet the amount specified and to check that there exist no reasons why the
cheque should not be honoured. Those cheques accepted and which are of outstation are
charged a handling fee, otherwise a charge at standard rates will be made.
3. A University has the following criteria for deciding whether or not to admit a student for
its graduate school:
4. Complete and simplify the following decision table.
Reservation procedure RULES
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16

C1 Request for I Class

C2 Requested Space available

C3 Alternate Class acceptable

C4 Alternate Class available

A1 Make I Class reservation

A2 Make tourist reservation

A3 Name on I Class wait list

A4 Name on tourist wait list

Admit a student who has undergraduate grades of B or better, has test scores of the
admission tests of over 550 and has a grade average of B or better for the past two years.
Also, admit if overall grade average is less than B but the last two years average is B or better
and the test scores is over 550. Admit on probation if the over all and 2 years grade averages
are B or better and test scores is 550 or less. Admit on probation if overall grades are B or
better and test score is above 550 but last 2 years grade averages are below B. Also, admit on
probation if overall grade average is less than B and test score is 550 or less, but grades for
past two years are B or better. Refuse to admit all others.
Prepare a decision table for the above criteria.

The Institute of Chartered Accountants of India


6.10 Information Technology

6.3 Flowchart for A Decision Table


Example: Below is given the decision table on the wage calculation in an organisation. Gross
Pay (G.P.) is derived from the Guaranteed Minimum (G.M.) as follows:
GP = 1.05 GM when quantity produced, Q 100
= 1.15 GM when Q 120
= 1.25 GM when Q 130
Also awarded is the quality bonus if a certain level of quality has been attained by the worker.
However, in case Q 130 and the worker also attains the aforesaid quality level, his gross
pay GP = 1.25 GM + Quality bonus is subject to an overall maximum check which is
performed by means of subroutine, SR 2 with the details of which we would not concern
ourselves for the limited purpose ahead. In the programme also incorporated is SR 3 which
validates the Wage No. in a transaction i.e., it checks if the wage No. is correct. Here again we
would not be concerned with the details of the subroutine which are beyond the scope of this
discussion. The exist from the program is made to a subroutine, SR4, the details of which we
ignore. The description has been captured in the first two parts of the decision table below:
Part I Contains all the possible questions, 5 in number.
Part II Lists all the possible actions.
Part III Lists the 9 feasible sets of answers. For example, the first set has Yes to all the 5
questions and the last set has No to the first question and it bypasses the other
questions which is noted by dots in its column.
Part IV Indicates, by means of crosses (X) the actions to be taken for each set of condition
entries. For example, under the set of answers, 1 (all yes) there are four actions to
be taken as noted by 4 crosses in the action entry column below it.
The systems analysts/programmer will first compile this decision table and therefrom draw the
flowchart because he can set out the table without any likelihood of ignoring an answer set. In
this section, our endeavor is to explain how the flowchart is drawn from a given table. We shall
take this table as an example.
N.B., Often the flowchart for a decision table (when it is small) can be drawn by common
sense by comprehending its items.
Conditions Rules
1 2 3 4 5 6 7 8 9
Valid wage No. ? Y Y Y Y Y Y Y Y N
Part I Qty. produced100? Y Y Y Y Y N N N -
Qty. produced120? Y Y Y Y Y N - - - Part III
Qty. produced 130? Y Y N N - - - - - sets of
Quality bonus ? Y N Y N Y N Y N - Answer

The Institute of Chartered Accountants of India


Decision Table 6.11

Gross pay = GP - - - - - - X X -
GP = 1.05 GM - - - - X X - - -
GP = 1.15 GM - - X X - - - - -
Part II GP = 1.25 GM X X - - - - - - - Part IV
Add quality bonus X - X - X - - - - sets of
Actions do max. check X - - - - - X - - Answer
SR. 2
do invalid wage
No SR 3 - - - - - - - - X
go to this table - - - - - - - - X
do deductions
calculations X X X X X X X X
In Fig. 6.3.1, we draw the segment of the flowchart for answers and actions of column 1 in the
table.
In Fig. 6.3.2, we endeavor to superimpose the segment of column 2 (shown in dotted line in
Fig. 6.3.2) on Fig. 6.3.1. But we see for the question quality bonus ?, for both yes and no
to it we find
GP = 1.25 G.M.
Obviously then we should first compute
GP = 1.25 G.M.
and then pose this question i.e. Fig.6.3.2 needs modification which has been done in Fig
6.3.3.
In Fig. 6.3.4, we have superimposed the segment for col. 3 (in crosses) onto that of Fig. 6.3.3
and we notice that the question quality bonus? has to be posed once again.
In this manner, we continue column-wise superimposition of segments until we end up with
final flowchart as in Fig. 6.3.5 below,
This shows that the flowchart is drawn by trial and error from the given table and quite a few
erasures and rework would be involved. Also, when the final flowchart has been drawn, it can
be verified against the given decision table.

The Institute of Chartered Accountants of India


6.12 Information Technology

Fig.6.3.1 Fig.6.3.3
Fig.6.3.2

Fig. 6.3.4 Fig. 6.3.5

The Institute of Chartered Accountants of India


Decision Table 6.13

6.4 Advantages and Disadvantages of Decision Tables


A decision table has a number of advantages which are stated below:
(i) A decision table provides a framework for a complete and accurate statement of
processing or decision logic. It forces a discipline on the programmer to think through all
possible conditions.
(ii) A decision table may be easier to construct than a flow chart.
(iii) A decision table is compact and easily understood making it very effective for
communication between analysts or programmers and non-technical users. Better
documentation is provided by it.
(iv) Direct conversion of decision table into a computer program is possible. Software
packages are available which take the statement specifying a decision table and compile
it into a program.
(v) It is possible to check that all test combinations have been considered.
(vi) Alternatives are shown side by side to facilitate analysis of combinations.
(vii) The tables show cause and effect relationships.
(viii) They use standardized format.
(ix) Typists can copy tables with virtually no question or problems.
(x) Complex tables can easily be split into simpler tables.
(xi) Table users are not required to possess Computer knowledge.
Disadvantages of using decision tables are as follows:
(i) Total sequence - The total sequence is not clearly shown i.e., no overall picture is given
by decision tables as presented by flow charts.
(ii) Logic - Where the logic of a system is simple, flowcharts nearly always serve the purpose
better than a decision table.

6.5 Miscellaneous Exercises


Question 1
The details of procedure for dealing with delivery charges for goods bought from ABC
Company is given below:
For calculating the delivery charges, customers are divided into two categories, those whose
sales region code is 10 or above and those with the code of less than 10.
If the code is less than 10 and the invoice amount is less than ` 10,000, the delivery charge
to be added to the invoice total is ` 200. But if the invoice value is for ` 10,000 or more, the
delivery charge is ` 100.

The Institute of Chartered Accountants of India


6.14 Information Technology

If the code is equal to or greater than 10, the corresponding delivery charges are ` 250 and `
150 respectively.
Required:
i. Prepare a decision table of the above procedure
ii. Prepare a program flowchart segment of the above procedure.
Question 2
While invoicing each customer, the invoice clerk has to work out the discounts allowable on
each order. Any order over ` 20,000 attracts a bulk discount of 8%.
A customer within the trade is allowed 10%. There is also a special discount of 5% allowed
for any customer who has been ordering regularly for over 5 years.
Construct :- (i) A Flow Chart (ii) A decision table; to illustrate the clerical procedure for working
out this management policy.
Question 3
A hire-purchases scheme has adopted the following criterion for its customers. The customers
will get the credit facility if they satisfy any of the following conditions:
(i) The customer must hold the present job for more than 5 years and reside in the same
place at least for 3 years. In this case, the customer will get credit upto rupees three
thousand.
(ii) The monthly salary of the customer must exceed rupees two thousand and must hold the
present job for more than 5 years. In this case credit will be given upto rupees four thousand.
(iii) The monthly salary must exceed rupees two thousand and reside at the same place at
least for 3 years. In this case credit will be given upto rupees four thousand.
(iv) In the case, the customers monthly salary exceeds rupees two thousand, holds the
present job for more than 5 years and also reside in the same place at least for the 3
years, the credit facility will be upto rupees five thousand.
The credit facility is rejected for all other customers. Prepare a decision table for this hire-
purchase scheme.
Question 4
A. computer file has customer name, type, bill number, bill date, amount and the date of
payment. If the customer is a dealer and pays his bills within 30 days, 10% discount is allowed. If it
is 30 to 45 days, discount and surcharge is zero. If he pays after 45 days, he has to pay 10%
surcharge. The corresponding percentages for a manufacturer are 12%, 0, 12 %.
a. Write a decision table for the above problem.
b. Write a flowchart to calculate the discount, surcharge and net amount of each customer and
print.

The Institute of Chartered Accountants of India


Decision Table 6.15

Answer 1: Decision Table


Rules
1. 2. 3. 4.
Conditions Condition entries
Sales region code = 10. Y Y N N
Invoice amount < ` 10,000 Y N Y N
Action Stub Action entry
Delivery charges
Add ` 100 to invoice total X
Add ` 150 to invoice total X
Add ` 200 to invoice total X
Add ` 250 to invoice total X

The flowchart is given below.

The Institute of Chartered Accountants of India


6.16 Information Technology

Answer 2:
The flowchart is given below:

START

READ OV, TC,


YOR

OV > NO
Rs. 20,000
?

YES

DISC = 0.08 +
OV

IS NO
HE A TC
?
YES
DISC = DISC +
0.1 + OV

IS NO
YOR > 5 YRS
?

YES

DISC = DISC +
0.05 + OV

NO LAST YES
RECORD STOP
?

Decision Table is given below:


RULES
Conditions: 1 2 3 4 5 6 7 8
1. Order - Value ` 20,000 Y Y Y Y N N N N
2. Trade - Customer Y Y N N Y Y N N
3. Year Ordering
Regularly > 5 Years Y N Y N Y N Y
Actions :
Nil Discount X
5% X

The Institute of Chartered Accountants of India


Decision Table 6.17

8% X
10% X
13%
15% X X
18%
23% X X X
KEY: Y = YES, N = NO, X = ACTION TO BE TAKEN
Answer 3:
Hire Purchase Scheme R1 R2 R3 R4 R5 R6 R7
1. Customer holds the present job for Y Y Y Y N N N
more than 5 years
2. Resides in the same place at least Y Y N N Y N N
for 3 years
3. Monthly salary of the customer Y N Y N Y N
exceeds ` 2000

1. Give credit upto ` 3000 X


2. Give credit upto ` 4000 X X
3. Give credit upto ` 5000 X
4. Reject credit X X X
Answer 4 (a): The decision table is given below :
Decision table
RULES R1 R2 R3 R4 R5 R6 R7 R8
C1 Customer Dealer Y Y Y N N N Y -
C2 Payment Days >30 Days Y N - Y N N Y N
C3 >30 & <45 days - Y N - Y N Y Y
C4 > 45 days N - Y - - Y Y N
Actions
A1 Discount 10% X
A2 Discount & Surcharge 0 X
A3 Surcharge 10% X X
A4 Discount 12% X
A5 Surcharge 12% X X X

The Institute of Chartered Accountants of India


6.18 Information Technology

(b) The flowchart is given below

Summary
The chapter on Decision table defines the possible contingencies and appropriate course of
actions for each program. Various parts and the components of a Decision Table are explained in
detail. This chapter discusses about different types of decision tables and the steps in preparing
each one of them. Many practical examples (solved) have been given at the end of this chapter for
understanding the concepts of decision table by the students.

The Institute of Chartered Accountants of India

You might also like