You are on page 1of 47

Problem Solving with Decisions

Chapter 6

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Objectives
1. Develop problems using the decision logic structure in conjunction with the sequential logic structure. 2. Use the seven problem-solving tools when developing a solution using the decision logic structure. 3. Use nested decision instructions to develop a problem solution.

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Objectives
4. Distinguish the different uses of straightthrough, positive, and negative nested decision logic structures. 5. Convert a positive decision logic structure to a negative decision logic structure. 6. Develop decision tables given a set of policies. 7. Develop a decision logic structure from a decision table.

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

The Decision Logic Structure

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.1 Flowchart Diagram of the Decision Structure

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.2 Single Condition Two Possible Actions or Sets of Actions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.3 Nested If/Then/Else Instructions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.4 Straight-Through LogicExample 1

Algorithm

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.4 StraightThrough Logic Example 1

Flowchart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.5 Another Example of Straight-Through Logic - Example 2

Algorithm

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.5 Another Example of StraightThrough Logic Example 2

Flowchart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.6 Positive LogicExample 1

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.7 Positive LogicExample 2

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.7 Positive LogicExample 2

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.7 Positive Logic Example 2

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.8 The Conditions in Figure 6.7 Set Up in a Different Way

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.8 The Conditions in Figure 6.7 Set Up in a Different Way

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.8 The Conditions in Figure 6.7 Set Up in a Different Way

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.9 Negative LogicExample 1

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.10 Negative LogicExample 2

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.10 Negative LogicExample 2

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.10 Negative Logic Example 2

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.11 The Conditions in Figure 6.10 Set Up in a Different Way

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.11 The Conditions in Figure 6.10 Set Up in a Different Way

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.11 The Conditions in Figure 6.10 Set Up in a Different Way

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.12 Conversion from Positive Logic to Negative Logic

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.12 Conversion from Positive Logic to Negative Logic

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.13 Four Ways to Design a Set of Conditions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.13 Four Ways to Design a Set of Conditions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Table 6.1 Decision Table Format

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.14a Starting Flowchart from Table 6.1

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.14b Elimination of Conditions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.14c Final Flowchart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Table 6.2 Decision Table

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.15a Starting Flowchart from Table 6.2

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.15b Elimination of Conditions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.15c Final Flowchart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.15c Final Flowchart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16a Fantastic Floral CompanyProblem Analysis Chart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16b Fantastic Floral CompanyStructure Chart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16c Fantastic Floral CompanyIPO Chart

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16d Coupling Diagram

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16d Data Dictionary

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16e The Algorithms and Flowcharts Control Module

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16f The Algorithms and FlowchartsRead Module

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16g The Algorithms and FlowchartsCalc Module

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 6.16h The Algorithms and FlowchartsPrint Module

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

You might also like