1. Define a Boolean predicate for each of the following statements: a. Tom\'s tr
ID: 3594707 • Letter: 1
Question
1. Define a Boolean predicate for each of the following statements: a. Tom's truck is red b. John's house is yellow C. Mary's car is blue 2. Declare a Java boolean variable for each of the Boolean predicates from the previous question 3. Write a Boolean expression for each of the following statements, using the Boolean predicates in question 1: a. John's house is not yellow b. It is not the case that Mary's car is not blue c. Either Tom's truck is red, or Mary's car is blue and John's house is yellow d. It is true that both Tom's truck is red or Mary's car is blue, and John's house is yellow e. Neither is John's house yellow, nor is Mary's car blue (in other words, John's house is not yellow, and Mary's car is not blue) g. It is true that either John's house is yellow, or Tom's truck is red, but both are not true. h. Mary's car is blue if and only if John's house is yellow. 4. Write a Java boolean expression for each of the Boolean expressions from the previous question, using the boolean variables declared in question 2Explanation / Answer
boolean isTomTruckRed;
boolean isJohnHouseYellow;
boolean isMaryCarBlue;
a) ! isJohnHouseYellow
b) !(!isMaryCarBlue )
c) (isTomTruckRed ) || (isMaryCarBlue && isJohnHouseYellow )
d) (isTomTruckRed || isMaryCarBlue ) && isJohnHouseYellow
e) (!isJohnHouseYellow && !isMaryCarBlue )
f) isJohnHouseYellow && isMaryCarBlue
g) isJohnHouseYellow != isMaryCarBlue
h) isJohnHouseYellow && isMaryCarBlue
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.