1 / 25

CHAPTER 10

CHAPTER 10. Decision Tables. Content. Introduction construction Types of Decision Tables Limited Entry Extended Entry Combining of Rules General Rule Q & A. Introduction. Some programs require solution using multiple decisions to produce the correct output.

ban
Download Presentation

CHAPTER 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHAPTER 10 Decision Tables

  2. Content • Introduction • construction • Types of Decision Tables • Limited Entry • Extended Entry • Combining of Rules • General Rule • Q & A

  3. Introduction • Some programs require solution using multiple decisions to produce the correct output. • This can be a difficult task as this is not always readily apparent • Decision Tables is a problem-analysis tool used to solved complex decision logic • Decision tables offer a complete, concise and logical way of relating combinations of actions to combinations of conditions

  4. Introduction • all appropriate conditions must be satisfied before the conclusion is drawn and the specified action or actions taken • The basic concept of the decision table is therefore the IF…and IF…THEN… relationship. • Decision Table is constructed beforeflow chart or structure chart is drawn

  5. Construction • The four basic elements of the decision table are known as: • The condition stub • The condition entries/rules • The action stub • The action entries Decision Tables Quadrants

  6. Construction • The condition stub describe the conditions to be tested • Condition entries describes the possible combination of Boolean values (Yes/No or simply Y/N) for the conditions • The action stub contains possible actions based on the conditions • and action entries describe the actions to be taken which correspond to each Boolean value of each condition.

  7. Construction • Steps • List all possible conditions • Determine how many possible Boolean values combinations/rules. Since each condition has 2 outcomes (T/F), therefore the number of rules is determined by 2n where n is the number of conditions e.g. with 3 conditions, there must be 6 rules - boolean columns • List all possible actions • For each rule, select the appropriate action/s. Indicate with ‘X’ or tick.

  8. Example • Consider the following simple logical situation • If it is cold and wet, I will take my sweater and umbrella. • If it is cold, I will take my sweater. • If it is wet, I will take my umbrella. • If it is neither cold nor wet, I will take neither.

  9. Example of construction • STEP 1 : List all possible conditions • Is it cold? • Is it wet? • STEP 2 : Determine how many possible Boolean values combinations/rules • Conditions - 2 • Thus rules = 22 , which is 4

  10. Condition stub Condition entries Example of construction Is it cold? Is it wet?

  11. Example of construction • STEP 3 : List all possible actions • Take sweater • Take umbrella • Take neither

  12. Action entries Action stub Example of construction • STEP 4 : For each rule, select the appropriate action/s indicated by ‘X’ or tick. The situation is expressed in a decision table as follows:

  13. Types of Decision Tables • 2 Types:- • Limited Entry Table • Extended Entry Table

  14. Limited Entry Table • expresses each condition in the condition stub as a question which can be answered ‘Yes’ or ‘No’(2 states) – indicated by Y/N • If condition is inapplicable for any particular rule, entry is indicated by a dash/blank • The number of condition rules required is determine by the formula 2n

  15. Example • Determine the rate of discount allowed and whether or not there is free delivery according to the purchaser and/or type of purchase. If the goods are assumed to be televisions with either 23 or 29 inches screens, dealers being approved or non-approved and the sets themselves being either walnut or plastic finish, solve the problem using a decision table if: 1. Non-approved dealers are allowed 5% discount. 2. Approved dealers are allowed – a. free delivery on 29 inch sets b. 25% discount on 29 inch walnut c. 20% on other sets

  16. Solution

  17. Extended Entry Tables • Also known as Mixed Entry Table. • Used when the condition entry contains not a straight forward ‘Yes’ or ‘No’ answer • For example, a condition might be ‘DIRECTION’ and the condition entries ‘North’, ‘South’, ‘East’ and ‘West’.

  18. Extended Entry Tables • The number of condition rules required is determine by the multiplying the number of outcome of each conditions. • E.g. condition1 has 2 outcome (Y/N) condition2 has 3 outcome (100,200,300) condition3 has 2 outcome (Y/N) Therefore no. of rules required 2x3x2 = 12 rules

  19. Example • An order will be approved if a guarantee is available and credit is $100, or if there is no guarantee but credit is $200 in which case special clearance does not apply, or if credit is $100, there is no guarantee and special clearance is given, or if credit is $300, there is no guarantee and no special clearance. If there is no guarantee, credit is $100 and special clearance is not given, the order is not approved and is returned to the client.

  20. solution

  21. General Rules of combining rules • If, for any combination of rules, the condition entries are identicalexcept for one row and the action entries are also identical, the two rules can be combined, a dash being inserted in place of the conditions which are not the same.

  22. Combining of Rules • It is possible to combine rules if they are having the same actions. • E.g. • If it is cold or wet, I will take my jacket

  23. Combination of rules • It will be noted that for rules 1 and 2 in which the status of the first condition is Yes, the status of the second is immaterial. The action to be taken is the same whether the answer is Yes or No. This is indicated by a dash. • The new table will be:

  24. Combination of rules • The new table for the problem on “Discount” is:

  25. Class Exercise – Create a decision table for the following problem: • A carpenter needs a program that computes the price of any desk a customer orders based on the following input fields; order number, desk length in inches and width in inches (3 digits each, no decimals), type of wood (assumed valid type is entered), and a number of drawers (2 digits). The price is computed as follows: • The charge for all desk minimum is $200 • If the surface area is over 750 sq. in., add $50 • If the wood is “mahogany” add $150; for “oak” add $125. No charge is added for “pine” • For every drawer in the desk, there is an additional $30 charge

More Related