CS 111 - 10/21/14
Exam 1 Results 15% of the final letter grade
Count: 140
Max: 99
Min: 21
Average: 73.21
Median: 75
St. Dev: 17.35
90's: 22
80's: 37
70's: 32
60's: 21
50's: 13
40's: 7
30's: 5
20's: 3
Boolean Operators: AND, OR NOT
AND: Syntax &&
Binary Operator (i.e. takes two operands)
evaluates to true if both operands are true
otherwise evaluates to false
( (x < 5) && ( y == 3) )
OR: Syntax ||
Binary Operator
evaluates to true if either (or both) operand
is true, otherwise evaluates to false
( (x < 5) || ( y == 3) )
NOT: Syntax !
Unary Operator (I.E. Takes one operand )
evaluates to true if the operand is false,
otherwise evaluates to false
( ! ( x < 4 ) )
The most common use of the Boolean Operators is to
check if a value is in a particular range of numbers
print x if x is within the range from 0 to 100 inclusive
if ( ( x >= 0 ) && (x <= 100) )
{
System.out.println ("X contains: " + x);
}
Truth Tables:
X Y || X && Y X || Y !X
----------------------------------------------
T T || T T F
T F || F T F
F T || F T T
F F || F F T