Page 140 - Introduction to Programming with Java: A Problem Solving Approach
P. 140
106 Chapter 4 Control Statements
CHAPTER 4
Control Statements
Objectives
• Learn how to use if statements to alter a program’s sequence of execution.
• Become familiar with Java’s comparison and logical operators, and learn how to use them to describe
complex conditions.
• Learn how to use the switch statement to alter a program’s sequence of execution.
• Recognize repetitive operations, understand the various kinds of looping that Java supports, and learn
how to select the most appropriate type of loop for each problem that requires repetitive evaluation.
• Be able to trace a looping operation.
• Learn how and when to nest a loop inside another loop.
Apago PDF Enhancer
• Learn how to use boolean variables to make code more elegant.
• Learn how to validate input data.
• Optionally, learn how to simplify complicated logical expressions.
Outline
4.1 Introduction
4.2 ConditionsandBooleanValues 4.3 ifStatements
4.4 &&LogicalOperator
4.5 ||LogicalOperator
4.6 !LogicalOperator
4.7 switchStatement
4.8 whileLoop
4.9 doLoop
4.10 forLoop
4.11 SolvingtheProblemofWhichLooptoUse 4.12 NestedLoops
4.13 booleanVariables
4.14 InputValidation
4.15 ProblemSolvingwithBooleanLogic(Optional)
106