Chapter 2 Beginning ProblemSolving Concepts for the Computer
Chapter 2 Beginning Problem-Solving Concepts for the Computer Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle and Jim Hubbard Copyright © 2012 Pearson Education, Inc.
Overview � Constants and Variables � Data Types � How the Computer Stores Data � Functions � Operators � Expressions and Equations. Bullet, etc 02
Objectives 1. 2. 3. Differentiate between variables, constants. Differentiate between character, numeric, and logical data types. Identify operators, operands, resultants. 03
Objectives 5. 6. 7. Identify, use functions Identify, use operators according to placement in hierarchy chart. Set up, evaluate expressions and equations using variables, constants, operators, and the hierarchy of operations. 04
Figure 2. 1 Important Concepts to Learn 05
Table 2. 1 Constants and Variables on the Computer 06
Table 2. 1 Constants and Variables on the Computer 07
Rules for Naming and Using Variables 1. 2. 3. 4. Name a variable according to what it represents. Do not use spaces. Start a variable name with a letter. Do not use a dash or any other symbol that is used as a mathematical operator. 08
Rules for Naming and Using Variables 5. 6. 7. Consistent usage of variable name. Consistent use of upper, lowercase characters in variable names Use naming convention specified by your company 09
Table 2. 2 Incorrect Variable Names 010
Figure 2. 2 Processing Data—How a Computer Balances a Checkbook 011
Table 2. 3 Data Types and Their Data Sets 012
Table 2. 4 Examples of Data Types 013
Table 2. 4 Examples of Data Types 014
Table 2. 5 Functions 015
Table 2. 5 Functions 016
Table 2. 5 Functions 017
Table 2. 5 Functions 018
Table 2. 6 Operators and Their Computer Symbols 019
Table 2. 6 Operators and Their Computer Symbols 020
Table 2. 7 Definitions of the Logical Operators 021
Table 2. 7 Definitions of the Logical Operators 022
Table 2. 7 Definitions of the Logical Operators 023
Table 2. 8 Hierarchy of Operations 024
Table 2. 8 Hierarchy of Operations 025
Table 2. 9 Expressions and Equations 026
Evaluating a Mathematical Expression 027
Evaluating a Relational Expression 028
Evaluating a Logical Expression 029
Evaluating an Equation That Uses Both Relational and Logical Operators 030
Developing a Table of All Possible Resultants of a Logical Expression unknown—A. � Two combinations: A can be either True or � One False. 031
Developing a Table of All Possible Resultants of a Logical Expression unknowns—A and B. � Four combinations: B can be either True or False for each value of A. . � Two 032
Developing a Table of All Possible Resultants of a Logical Expression unknowns—A, B, and C. � Eight combinations. � Three 033
Developing a Table of All Possible Resultants of a Logical Expression 034
Chapter 2 Beginning Problem-Solving Concepts for the Computer End Chapter 2 Copyright © 2012 Pearson Education, Inc.
- Slides: 35