01969_PPT_ch04

# 01969_PPT_ch04 - Programming Logic and Design Fifth...

This preview shows pages 1–14. Sign up to view the full content.

Programming Logic and Design Fifth Edition, Comprehensive Chapter 4 Making Decisions

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Programming Logic and Design, Fifth Edition, Comprehensive 2 Objectives Evaluate Boolean expressions to make comparisons Use the relational comparison operators Learn about AND logic Learn about OR logic Make selections within ranges
Programming Logic and Design, Fifth Edition, Comprehensive 3 Objectives (continued) Learn about precedence when combining AND and OR selections Learn more about the case structure Use a decision table

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Programming Logic and Design, Fifth Edition, Comprehensive 4 Evaluating Boolean Expressions to Make Comparisons Dual-alternative (or binary ) selection structure: Provides an action for each of two possible outcomes Figure 4-1 The dual-alternative selection structure
Programming Logic and Design, Fifth Edition, Comprehensive 5 Evaluating Boolean Expressions to Make Comparisons (continued) Single-alternative (or unary ) selection structure Action is provided for only one outcome Figure 4-2 The single-alternative selection structure

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Programming Logic and Design, Fifth Edition, Comprehensive 6 Evaluating Boolean Expressions to Make Comparisons (continued) Figure 4-3 Flowchart and pseudocode for overtime payroll program
Programming Logic and Design, Fifth Edition, Comprehensive 7 Evaluating Boolean Expressions to Make Comparisons (continued) Figure 4-4 Pseudocode for payroll program with dental insurance determination

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Programming Logic and Design, Fifth Edition, Comprehensive 8 Evaluating Boolean Expressions to Make Comparisons (continued) Boolean expression Represents only one of two states Evaluates to true or false Every decision in a computer program involves evaluating a Boolean expression Computer circuitry consists of two-state on-off switches Represented by 1 or 0 Every computer decision yields a true-false result
Programming Logic and Design, Fifth Edition, Comprehensive 9 Using the Relational Comparison Operators For any two values, three types of comparisons: Two values are equal First value greater than the second value First value less than the second value Relational comparison operators Express Boolean tests Different languages use different symbols

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Programming Logic and Design, Fifth Edition, Comprehensive 10 Using the Relational Comparison Operators (continued) Any logical situation can be expressed with only three types of comparisons: = , > , and < Operators >= and <= are not necessary, but make code more readable “Not equal” operator Most confusing of comparisons Most likely to be different in different languages
Programming Logic and Design, Fifth Edition, Comprehensive 11 Using the Relational Comparison Operators (continued) Figure 4-5 Using a negative comparison

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Programming Logic and Design, Fifth Edition, Comprehensive 12 Using the Relational Comparison Operators (continued) Figure 4-6 Using the positive equivalent of the negative comparison in Figure 4-5
Programming Logic and Design, Fifth Edition, Comprehensive 13 Using the Relational Comparison Operators (continued) Table 4-1 Relational comparisons

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 08/18/2011 for the course COMP 230 taught by Professor Deokar during the Summer '11 term at DeVry Cincinnati.

### Page1 / 50

01969_PPT_ch04 - Programming Logic and Design Fifth...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online