Upload
hakhue
View
240
Download
7
Embed Size (px)
Citation preview
Copyright © 2012 Pearson Education, Inc.
Chapter 1
General Problem Solving Concepts
Problem Solving and Programming Concepts
9th Edition
By Maureen Sprankle and Jim Hubbard
Copyright © 2012 Pearson Education, Inc. 0-2
Overview
• Problem Solving in Everyday Life
• Types of Problems
• Problem Solving with Computers
• Difficulties with Problem Solving
Copyright © 2012 Pearson Education, Inc.
Objectives
1. Describe difference between heuristic,
algorithmic solutions.
2. List, describe problem-solving steps for
algorithmic solution.
3. Use problem-solving steps to solve
problem.
0-3
Copyright © 2012 Pearson Education, Inc.
Problem Solving in Everyday Life
1. Identify the problem.
2. Understand the problem.
3. Identify alternative ways to solve problem.
4. Select best alternative.
5. List solution steps for alternative chosen.
6. Evaluate solution.
0-4
Copyright © 2012 Pearson Education, Inc.
Types of Problems
Problems with …
• Algorithmic solutions
• Heuristic solutions
• Combination of algorithmic, heuristic
solutions
0-5
Copyright © 2012 Pearson Education, Inc.
Problem Solving with Computers
Definitions:
• Solution instructions followed to
produce best result
• Result outcome, computer-assisted
answer
• Program instructions for solution using
computer language
0-6
Copyright © 2012 Pearson Education, Inc.
Difficulties with Problem Solving
• Lack of problem solving experience
• Inadequate solution steps
• Incorrect problem definition
• Alternatives chosen incorrectly
• Invalid logic
• Incorrect solution evaluation
0-7
Copyright © 2012 Pearson Education, Inc.
Chapter 1
General Problem Solving Concepts
End Chapter 9
Copyright © 2012 Pearson Education, Inc.
Chapter 2
Beginning Problem-Solving
Concepts for the Computer
Problem Solving and Programming Concepts
9th Edition
By Maureen Sprankle and Jim Hubbard
Copyright © 2012 Pearson Education, Inc. 0-10
Overview
• Constants and Variables
• Data Types
• How the Computer Stores Data
• Functions
• Operators
• Expressions and Equations
Copyright © 2012 Pearson Education, Inc.
Objectives
1. Differentiate between variables,
constants.
2. Differentiate between character, numeric,
and logical data types.
3. Identify operators, operands, resultants.
0-11
Copyright © 2012 Pearson Education, Inc.
Objectives
5. Identify, use functions
6. Identify, use operators according to
placement in hierarchy chart.
7. Set up, evaluate expressions and
equations using variables, constants,
operators, and the hierarchy of
operations.
0-12
Copyright © 2012 Pearson Education, Inc.
Figure 2.1 Important Concepts to
Learn
0-13
Copyright © 2012 Pearson Education, Inc.
Table 2.1 Constants and
Variables on the Computer
0-14
Copyright © 2012 Pearson Education, Inc.
Table 2.1 Constants and
Variables on the Computer
0-15
Copyright © 2012 Pearson Education, Inc.
Rules for Naming and Using
Variables
1. Name a variable according to what it
represents.
2. Do not use spaces.
3. Start a variable name with a letter.
4. Do not use a dash or any other symbol
that is used as a mathematical operator.
0-16
Copyright © 2012 Pearson Education, Inc.
Rules for Naming and Using
Variables
5. Consistent usage of variable name.
6. Consistent use of upper, lowercase
characters in variable names
0-17
Copyright © 2012 Pearson Education, Inc.
Table 2.3 Data Types
and Their Data Sets
0-18
Copyright © 2012 Pearson Education, Inc.
Table 2.4 Examples of Data Types
0-19
Copyright © 2012 Pearson Education, Inc.
Table 2.4 Examples of Data Types
0-20
Copyright © 2012 Pearson Education, Inc.
Table 2.5 Functions
0-21
Copyright © 2012 Pearson Education, Inc.
Table 2.6 Operators and Their
Computer Symbols
0-22
Copyright © 2012 Pearson Education, Inc.
Table 2.6 Operators and Their
Computer Symbols
0-23
Copyright © 2012 Pearson Education, Inc.
Table 2.7 Definitions of the Logical
Operators
0-24
Copyright © 2012 Pearson Education, Inc.
Table 2.7 Definitions of the Logical
Operators
0-25
Copyright © 2012 Pearson Education, Inc.
Table 2.7 Definitions of the Logical
Operators
0-26
Copyright © 2012 Pearson Education, Inc.
Table 2.8 Hierarchy of Operations
0-27
Copyright © 2012 Pearson Education, Inc.
Table 2.8 Hierarchy of Operations
0-28
Copyright © 2012 Pearson Education, Inc.
Table 2.9 Expressions and Equations
0-29
Copyright © 2012 Pearson Education, Inc.
Evaluating a Mathematical
Expression
0-30
Copyright © 2012 Pearson Education, Inc.
Evaluating a Relational Expression
0-31
Copyright © 2012 Pearson Education, Inc.
Evaluating a Logical Expression
0-32
Copyright © 2012 Pearson Education, Inc.
Evaluating an Equation That Uses
Both Relational and Logical
Operators
0-33
Copyright © 2012 Pearson Education, Inc.
Chapter 2
Beginning Problem-Solving
Concepts for the Computer
End Chapter 2
Copyright © 2012 Pearson Education, Inc.
Chapter 3
Planning Your Solution
Problem Solving and Programming Concepts
9th Edition
By Maureen Sprankle and Jim Hubbard
Copyright © 2012 Pearson Education, Inc. 0-36
Overview
• Communicating with the Computer
• Organizing the Solution
• Using the Tools
• List and describe development tools
• Use problem analysis chart
• Use interactivity chart
• Use IPO (Input-Process-Output) chart
• Use algorithms and flowcharts
Copyright © 2012 Pearson Education, Inc.
Analyzing the Problem
Understand requirements:
1. The given data
2. The required results
3. The processing that is required in the
problem
4. A list of solution alternatives
0-37
Copyright © 2012 Pearson Education, Inc.
Figure 3.1 Problem Analysis Chart
0-38
Copyright © 2012 Pearson Education, Inc.
Figure 3.2 Problem Analysis Chart for
the Payroll Problem
0-39
Copyright © 2012 Pearson Education, Inc.
Figure 3.3 The Interactivity Chart
0-40
Copyright © 2012 Pearson Education, Inc.
Figure 3.4 The Completed Interactivity
Chart
0-41
Copyright © 2012 Pearson Education, Inc.
Figure 3.5 The Interactivity Chart for
the Payroll Problem
0-42
Copyright © 2012 Pearson Education, Inc.
Figure 3.6 The IPO Chart
0-43
Copyright © 2012 Pearson Education, Inc.
Figure 3.7 The IPO Chart for the
Payroll Problem
0-44
Copyright © 2012 Pearson Education, Inc.
Figure 3.8 The Form of an Algorithm
0-45
Copyright © 2012 Pearson Education, Inc.
Figure 3.9 Flowchart Symbols
0-46
Copyright © 2012 Pearson Education, Inc.
Figure 3.9 Flowchart Symbols
0-47
Copyright © 2012 Pearson Education, Inc.
Figure 3.9 Flowchart Symbols
0-48
Copyright © 2012 Pearson Education, Inc.
Figure 3.9 Flowchart Symbols
0-49
Copyright © 2012 Pearson Education, Inc.
Figure 3.10 The Algorithms and
Flowcharts for the Payroll Problem
0-50
Copyright © 2012 Pearson Education, Inc.
Figure 3.10 The Algorithms and
Flowcharts for the Payroll Problem
0-51
Copyright © 2012 Pearson Education, Inc.
Figure 3.10 The Algorithms and
Flowcharts for the Payroll Problem
0-52
Copyright © 2012 Pearson Education, Inc.
Figure 3.10 The Algorithms and
Flowcharts for the Payroll Problem
0-53
Copyright © 2012 Pearson Education, Inc.
Figure 3.11 Order of Execution of
Instructions
0-54
Copyright © 2012 Pearson Education, Inc.
Chapter 3
Planning Your Solution
End Chapter 3