copyright © 2012 pearson education, inc. chapter 6 problem solving with decisions problem solving...

34
Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle and Jim Hubbard

Upload: emory-riley

Post on 22-Dec-2015

227 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Chapter 6Problem Solving with Decisions

Problem Solving and Programming Concepts

9th Edition

By Maureen Sprankle and Jim Hubbard

Page 2: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc. 0-2

What is critical thinking?

• Q: What is the difference between a heuristic and algorithmic solution to a problem?

• The difference on algorithmic and heuristic solution is that algorithmic requires series of action, and heuristic is built on knowledge and experience

Page 3: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc. 0-3

What is critical thinking?

• A: There are set of steps

• H: There are no set of steps

• H: Relies on experience

• A: Doesn’t rely on experience?

• What are the definitions of …? (Big no)

Page 4: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc. 0-4

The Good, the Bad and the Ugly

• Examples?

• Good example saves insufficient definition

• Comparison of definitions

• Hand writing

Page 5: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Last week: Flowchart Diagram for the Sequential Structure

0-5

Page 6: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.1 Flowchart Diagram of the Decision Structure

0-6

Page 7: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.2 Single Condition—Two Possible Actions or Sets of Actions

0-7

Page 8: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.3 Nested If/Then/Else Instructions

0-8

Page 9: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.4 Straight-Through Logic—Example 1

0-9

Page 10: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

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

0-10

Page 11: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Nested If/Then/Else vs.Straight-Through Logic

0-11

Page 12: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.6 Positive Logic—Example 1

0-12

Page 13: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.7 Positive Logic—Example 2

0-13

Page 14: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

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

0-14

Page 15: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.9 Negative Logic—Example 1

0-15

Page 16: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.10 Negative Logic—Example 2

0-16

Page 17: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

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

0-17

Page 18: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.12 Conversion from Positive Logic to Negative Logic

0-18

Page 19: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.12 Conversion from Positive Logic to Negative Logic

0-19

Page 20: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.12 Conversion from Positive Logic to Negative Logic

0-20

Page 21: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.13 Four Ways to Design a Set of Conditions

0-21

Page 22: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.13 Four Ways to Design a Set of Conditions

0-22

Page 23: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.13 Four Ways to Design a Set of Conditions

0-23

Page 24: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.13 Four Ways to Design a Set of Conditions

0-24

Page 25: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Four Ways to Design a Set of Conditions

0-25

Page 26: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.17 Flowchart Diagram for the Case Logic Structure

0-26

Page 27: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.18 Alternate Flowchart Diagram for the Case Logic Structure

0-27

Page 28: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.21 Using Codes—Medical Insurance Problem— InsuranceDeduction Module

0-28

Page 29: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.22 Algorithm and Flowchart to Illustrate Pay Module

0-29

Page 30: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.20 Straight-through Decision Structure Equivalent to the Case Logic Structure

0-30

Page 31: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.19 Nested Decision-Structure Equivalent to the Case Logic Structure

0-31

Page 32: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Figure 6.17 Flowchart Diagram for the Case Logic Structure

0-32

Page 33: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Which Decision Logic?

0-33

Page 34: Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle

Copyright © 2012 Pearson Education, Inc.

Chapter 6Problem Solving with Decisions

Good ExamplePages 133, 134, and 135

End Chapter 6