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

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 Solution

3.42 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

roll1 and roll2 are both 1s The sum of roll1 and roll2 is either 11 or 12 roll1 is between 2 and 5 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1409-C-S-O-S(1053).docx

120 KBs Word File

Students Have Also Explored These Related Operating System Questions!