Truth Tables and De Morgan's Rules
14. Another Demonstration
Answer:
Using the De Morgan Rule
!(A && B)
is equivalent to!A  !B
the original expression
boolean reject = !(speed > 2000 && memory > 512)
is equivalent to
boolean reject = !(speed > 2000)  !(memory > 512)
which is equivalent to
boolean reject = (speed <= 2000)  (memory <= 512)
Another Demonstration
Here is the other De Morgan rule:
!(A  B)
is equivalent to!A && !B
This truth table shows why this rule is true.
The fourth and the last column have the same truth values, which shows that the expressions at the top of those columns are equivalent.
A

B

(A  B)

!(A  B)

!A

!B

!A && !B


F

F

F

T

T

T

T

F

T

T

F

T

F

F

T

F

T

F

F

T

F

T

T

T

F

F

F

F

Question 14:
Rewrite the following fragment:
while ( !(input.equals( "quit" )  (count > limit)) ) { . . . }