## Truth Tables and De Morgan's Rules

Read this chapter, which discusses Boolean variables as used in decision tables. Truth tables are used to collect variables and their values relative to decisions that have to be made within control structures.

### 6. Truth Table

Answer:if (  !(speed > 2000 && memory > 512)  )
System.out.println("Reject this computer");
else
System.out.println("Acceptable computer");

# Truth TableConsider a computer with 2200 MHz speed and 750 Meg of memory. This computer is not rejected. Evaluation proceeds like this:

A truth table is another way to analyze the expression. The first two columns are filled with all possible truth values of the relational expressions. The remaining cells show how these truth values are combined.

If speed is 2200 and memory is 750 the the fourth row of the table is selected. The last column shows that this computer is not rejected. All computers are rejected except for those that meet both requirements, corresponding to the last row of the table.

speed > 2000memory > 512speed > 2000 && memory > 512Reject Computer if

!(speed > 2000 && memory > 512)
FF
FT
TF
TT

Question 6:Does the following program fragment do the same thing as the original fragment?boolean reject = !(speed > 2000 && memory > 512);

if (  reject  )
System.out.println("Reject this computer");
else
System.out.println("Acceptable computer");