A-level Computing/AQA/Problem Solving, Programming, Data Representation and Practical Exercise/Problem Solving/Decision tables

UNIT 1 - ⇑ Problem Solving ⇑

Structure charts Decision tables Finite state machines
Category:Book:A-level Computing#AQA/Problem%20Solving,%20Programming,%20Data%20Representation%20and%20Practical%20Exercise/Problem%20Solving/Decision%20tables

Decision tables are compact and precise ways of modelling complicated logic, such as that which you might use in a computer program. They do this by mapping the different states of a program to an action that a program should perform. Decision tables take on the following format:

The four quadrants
Conditions Condition alternatives
Actions Action entries

The limited-entry decision table is the simplest to describe. The condition alternatives are simple Boolean values, and the action entries are check-marks, representing which of the actions in a given column are to be performed.

A technical support company writes a decision table to diagnose printer problems based upon symptoms described to them over the phone from their clients. They type the following data into the advice program:

  1. Printer does print
  2. Red light is flashing
  3. Printer is recognised

The program then uses the decision table to find the correct actions to perform, namely that of Check / Replace ink.

Printer troubleshooter
Rules
Conditions Printer does not print Y Y Y Y N N N N
A red light is flashing Y Y N N Y Y N N
Printer is unrecognised Y N Y N Y N Y N
Actions Check the power cable     X          
Check the printer-computer cable X   X          
Ensure printer software is installed X   X   X   X  
Check/replace ink X X     X X    
Check for paper jam   X   X        
Example: Decision Tables

Let's take a look at a computer game example, for a football simulation the following rules are set up.

Rules
Conditions90 minutesYYY
Team A WinningY
Team B WinningYY
DrawY
ActionsGame OverXX
Team A WinsX
Team B WinsX
Extra TimeX
Keep PlayingXX

What happens when:

  1. 90 minutes up
  2. the game is a draw

Answer: Keep Playing and give them some extra time

Exercise: Decision Tables

Create a decision table for the following program in an office email system

  • Send email when Recipient address present, subject present, before 5:30pm
  • If after 5:30pm then put in pending folder
  • If Recipient address missing or subject message, give warning message

Answer:

This question is open to interpretation, but you should have something resembling this:

Rules
ConditionsAddress PresentYYY
Subject PresentYYY
Before 5:30YYY
ActionsSend MailX
Error MessageXX
Make pendingX

Describe the use of Decision Tables

Answer:

Determine logical conditions and consequential actions.

Category:Book:A-level Computing#AQA/Problem%20Solving,%20Programming,%20Data%20Representation%20and%20Practical%20Exercise/Problem%20Solving/Decision%20tables%20

UNIT 1 - ⇑ Problem Solving ⇑

Structure charts Decision tables Finite state machines
Category:Book:A-level Computing#AQA/Problem%20Solving,%20Programming,%20Data%20Representation%20and%20Practical%20Exercise/Problem%20Solving/Decision%20tables
Category:Book:A-level Computing