Using the De Morgan Rule
!(A || B)
is equivalent to!A && !B
The original expression
while ( !(input.equals( "quit" ) || (count > limit)) ) { . . . }
is equivalent to
while ( !input.equals( "quit" ) && !(count > limit)) ) { . . . }
which is equivalent to
while ( !input.equals( "quit" ) && (count <= limit)) ) { . . . }
The owner's manual for a car says to change the oil every three months or every 3000 miles.
boolean newOilNeeded = months >= 3 || miles >= 3000 ;
Here is an expression that shows when no oil change is necessary:
boolean oilOK = !( months >= 3 || miles >= 3000 );
Rewrite the expression using one of De Morgan's rules. Do this in two steps. In the first step, don't change the relational expressions.
boolean oilOK =
Now further simplify by changing the relational expressions.
boolean oilOK =