Search code examples
javacomputer-science

Drawing Truth Tables? A && (B || D)


I'm having trouble starting this truth table and drawing it out in my AP Computer Science class. A && (B || D) is what I have to draw.


Solution

  • Have a column for each individual value (A, B, D) and a row for every combination of values 2^3 = 8. Then, have additional columns for each intermediate calculation. In the end have another column for the complete expression. Now you can do the calculations step by step.

    You should end up with the following template:

     A | B | D | (B || D) | A && (B || D)
    ---+---+---+----------+--------------
     F | F | F |          |
     F | F | T |          |
     F | T | F |          |
     F | T | T |          |
     T | F | F |          |
     T | F | T |          |
     T | T | F |          |
     T | T | T |          |
    

    From here on, you should be able to solve your task.