Decision Tables:


Decision table is a tool used in solving complex program logic. It uses a tabular format to represent the work statement of a problem. The decision tables are extremely useful when a program involves a large number of decisions.
            As it is easier to draw and change the charts so decision tables are used in place of flowcharts. Moreover, the decision tables also provide compact documentation. However, due to difficulties involved in designing a flowchart they are not considered a common tool for program solving by the beginners.
Now before drawing the decision table, we should first identify all the condition statements and the corresponding actions to be taken.
The various conditions are:
Count <=10
Percentage>=50
Percentage<60

The various actions that can be taken are:
Calculate Percentage
Write Count
Add 1 to STU Count
Read next student record
Stop

We shall now arrange these condition statements and actions into a decision table as shown:
Each decision table has 6 parts, the Table Heading portion, the Decision Rule Number, the condition Stub that list the various condition statements, the Action Stub that list the various actions that can be taken, the Condition Entries Portion and the Action Entries portion. The condition entries are expressed by Y and N used for yes and No respectively. The action entries are represented by X mark.

In the above table, four rules are being made. These are discussed as follows:

Rule 1:   If COUNT <= 10 and PERCENTAGE is not greater than equal to 50 then computer should read the next student’s record.                                           

Rule 2:   If COUNT <= 10 and PERCENTAGE >= 50 , are true but PERCENTAGE is less than 60 is false then again computer should read the next students record.

Rule 3:   If COUNT >=10 and PERCENTAGE >=50 and PERCENTAGE <60 , it is true then computer should add 1 to STUCOUNT and read next student’s record.


Rule 4:   If COUNT <=10 is false then computer should print STUCOUNT and STOP.

Previous                                                                                    Next

Powered by Blogger.