Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

q (3) from A to D 1. Define a Boolean predicate for each of the following statem

ID: 3595325 • Letter: Q

Question

q (3) from A to D

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 quest 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

Explanation / Answer

Let's take following Predicates to represent the statements

R = Tom's truck is red
Y = John's house is yellow
B = Mary's car is blue

class Main{
   public static void main(String[] args)
   {
       boolean R = true;
       boolean Y = true;
       boolean B = true;
   }
}

a. ~Y
~ is negation which represents the opposite of it is correct. Since we want that John's house is not yellow, we are going for negation of Y

b. ~(~B)
It is not the case is "~"
Mary's car is not blue is ~B

c. R V (B Y)
V is for or
is for and

d. (R V B) Y