Imagine that variables roll1, roll2, and roll3 represent three die rolls (each storing a value between 1
Question:
Imagine that variables roll1, roll2, and roll3 represent three die rolls (each storing a value between 1 and 6). Examine the following Boolean expressions, then describe in English the condition that each represents.
(roll1 == 1 && roll2 == 1)
((roll1 + roll2 == 11) || (roll1 + roll2 == 12))
(roll1 > 2 && roll1 < 5)
(roll3 < 3 || roll3 > 4)
(roll1 == roll2 && roll2 == roll3)
(roll1 == 1 && roll2 == 1 && roll3 == 1)
Does the following expression correctly represent the condition that all three die rolls are different? That is, does this expression evaluate to true if all three variables have unique values, but evaluate to false in all other cases? If you believe that the expression accurately represents this condition, justify your claim. If not, provide a correct expression that performs the task.
(roll1 != roll2 && roll2 != roll3)
Step by Step Answer: