You are on page 1of 30

Beginning Problem-Solving Concepts for the Computer

Chapter 2

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. Differentiate between variables and constants. 2. Differentiate between character, numeric, and logical data types. 3. Identify operators, operands, and resultants. 4. Identify and use functions. 5. Identify and use operators according to their placement in the hierarchy chart. 6. Set up and evaluate expressions and equations using variables, constants, operators, and the hierarchy of operations.
Sprankle/Hubbard Problem Solving and Programming Concepts, 8e Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved.

Figure 2.1 Important Concepts to Learn

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.1 Constants and Variables on the Computer

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.1 Constants and Variables on the Computer

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.2 Incorrect Variable Names

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Figure 2.2 Processing Data How a Computer Balances a Checkbook

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.3 Data Types and Their Data Sets

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.4 Examples of Data Types

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.4 Examples of Data Types

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.5 Functions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.5 Functions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.5 Functions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.5 Functions

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.6 Operators and Their Computer Symbols

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.6 Operators and Their Computer Symbols

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.6 Operators and Their Computer Symbols

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.7 Definitions of the Logical Operators

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.7 Definitions of the Logical Operators

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.7 Definitions of the Logical Operators

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.8 Hierarchy of Operations

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.8 Hierarchy of Operations

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Table 2.9 Expressions and Equations

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Evaluating a Mathematical Expression

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Evaluating a Relational Expression

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Evaluating a Logical Expression

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Evaluating an Equation That Uses Both Relational and Logical Operators

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Developing a Table of All Possible Resultants of a Logical Expression


One unknownA. Two combinations: A can be either True or False. Two unknownsA and B. Four combinations: B can be either True or False for each value of A.

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Developing a Table of All Possible Resultants of a Logical Expression


Three unknownsA, B, and C. Eight combinations

Sprankle/Hubbard Problem Solving and Programming Concepts, 8e

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

Developing a Table of All Possible Resultants of a Logical Expression

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