Home /
Expert Answers /
Computer Science /
you-are-familiar-with-logical-operators-as-we-have-been-using-them-in-conditional-statements-whi-pa535
(Solved):
You are familiar with logical operators as we have been using them in conditional statements whi ...
You are familiar with logical operators as we have been using them in conditional statements while writing programs And (\&\&) Or (|l) Xor (^) A truth table is a mathematical table used in logic which has one column for each input and a corresponding column for each result of the logical operation on the input values. a. Create a TruthTable class with an inner functional interface: public interface BinaryLogicalop \{ public boolean compute(boolean a, boolean b); \} b. In main, define three BinaryLogicalop variables and initialize each with one of an anonymous class, a lambda expression, or a method reference (you choose which implementation for each variable). Binarylogicalop and \( =\ldots \) BinaryLogicalop or \( =\ldots \) Binarylogicalop xor \( =\ldots \) Hint: The Boolean wrapper class has three methods that can be of help: public static boolean logicalor(boolean a, boolean b) public static boolean logicalAnd (boolean a, boolean b) public static boolean logicalXor(boolean a, boolean b)
c. Using the three BinaryLogicalop variables above, print out a truth table for each combination of two input boolean values. d. Expected Output Each line of the above was formatted using string. format("\%-5s|\%-5s|\%-5s|\%-5s|\%-5s", ...)