Decision Tables:- Decision tables are powerful tools for expressing complex logical relationships in an understandable manner. The y are used to define clearly & concisely the decision statement of a problem in a tabular form. A decision table is a table of conditions for defining a problem & the actions to be taken.

> The table is divided into two horizontal & two vertical parts resulting in four distinct areas quadrants

> The quadrants are usually separated by double lines

> The left hand of upper portion called condition stub deals with the given conditions

> The right hand of upper portion called condition entry deals with the truth value of a condition. If the condition is true then mark Y against it otherwise N.

> The left-hand side of the lower portion of the decision table is called action stub & this portion enlists all the possible actions.

> The right-hand side of the lower portion is called Action Entry. If an action is to be taken depending upon the upper portion of the table then a mark (Y) or an (X) is written in the appropriate column otherwise it is left blank.

## Steps in writing decision Tables

1. Define the problem accurately that has to be solved by a computer.

2. List out all the conditions to be tested in the problem.

3. List out the corresponding actions that should be taken with each combination of conditions.

4. Form a decision table using the two lists.

## Types of Decision Table

### Limited Entry Table

If the stub portion completely defines the condition (or action), it is called a limited entry table.

### Extended Entry Table

If the stub portion does not completely express the condition (or action) then it is called an extended entry table.

Eg.

Develop a decision table to print the greatest of the three unequal positive numbers.

There are 3 conditions & thus 2.3    = 8 possible rules. Out of 8 rules, two rules are logically impossible. The other rules take care of all possibilities. A don’t care entry (-) corresponds to both true & false condition.

Eg.

A rule [Y, Y] will split up into two rules [YYN] and [YYY]

1. When the condition are numerous, then the decision table help to visualize the outcomes of a situation

2. Decision tables summarize all the outcomes of a situation & suggest suitable actions

3. They provide more compact documentation

4. Decision tables can be changed easily.

5. Decision table has a standard format.

### Rules Should be followed in Constructing Decision Table

1. A decision should be given a name, shown in the top left of the table.

2. The logic of the decision table is independent on the sequence in which the condition rules are written, but the action takes place in the order in which the events occur.

3. Standardized language must be used consistently.

4. Duplication of terms & meaning should be eliminated where possible.