The document discusses the if statement and other conditional control structures in Java including if-else, nested if-else, if-else if, and switch statements. It also covers logical operators, compound boolean expressions, short-circuit evaluation, and the Math class methods.
2. Chapter 5 Relational Operators Operator Meaning == equal < less than <= less than or equal > greater than >= greater than or equal != not equal
3. Chapter 5 The if-else Statement Contains an else clause that is executed when the if condition evaluates to false. For example, the statement if (x == 5) { y = 20; } else { y = 10; } assigns the value 20 to y if x is equal to 5 or the value 10 if x is not equal to 5.
4.
5.
6.
7.
8.
9. Chapter 5 And Truth Table False False False False True False False False True True True True Result Exp2 Exp1 And
10. Chapter 5 Or Truth Table False False False True True False True False True True True True Result Exp2 Exp1 Or
11. Chapter 5 Not Truth Table True False False True Result Exp Not
Refer to page 105 in the text. Relational operators are used to form Boolean expressions. Boolean expressions evaluate to true or false.
Refer to pages 106 and 107 in the text.
Refer to page 107 in the text.
Refer to page 108 in the text.
Refer to page 109 in the text.
Refer to pages 110 and 111 in the text. The Random class actually generates pseudorandom (like random) numbers. Java implements the Linear Congruential Method to ensure that generated numbers can be considered random for most applications.
Refer to page 112 in the text. Compound Boolean expressions use more than one Boolean expression to determine if a condition is true or false.
Refer to page 112 in the text.
Refer to page 112 in the text.
Refer to page 112 in the text.
Refer to page 113 in the text.
Refer to page 115 in the text. The diamond flowchart symbol indicates a decision.
Refer to page 115 in the text. The RPS flowchart illustrates the application solution. Solution steps include: 1. prompting the user for a number between 1 and 3 2. generating a random number between 1 and 3 3. comparing the generated number to the number typed by the user 4. determining a winner and displaying an appropriate message