boolean algebragorskicompsci.ca/ics2o/unit2/ppt1_booleanalgebra.pdf · operator meaning >...
TRANSCRIPT
![Page 1: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/1.jpg)
Boolean AlgebraResult in a True or False
![Page 2: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/2.jpg)
Named for
GeorgeBoole1815-1865
![Page 3: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/3.jpg)
&&
||
!
And
Or
Not
Some Java Symbols for you...
![Page 4: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/4.jpg)
![Page 5: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/5.jpg)
Can you read this shirt now?
![Page 6: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/6.jpg)
Boolean Algebra evaluates to only two answers.
True False||
![Page 7: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/7.jpg)
Operator Meaning
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
== Equal to
!= Not equal to
.equals() Equal for strings
Relational Operators
![Page 8: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/8.jpg)
![Page 9: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/9.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
![Page 10: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/10.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
F
![Page 11: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/11.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
F
T
![Page 12: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/12.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2F
T
T
![Page 13: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/13.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2
num == 4
F
T
T
F
![Page 14: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/14.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2
num == 4
!(num==3)
F
T
T
F
F
![Page 15: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/15.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2
num == 4
!(num==3)
F
T
T
F
F
T
![Page 16: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/16.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2
num == 4
!(num==3)
F
T
T
F
F
T
![Page 17: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/17.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2
num == 4
!(num==3)
F
T
T
F
F
T
![Page 18: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/18.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2
num == 4
!(num==3)
F
T
T
F
F
T
![Page 19: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/19.jpg)
The variable num holds the value of 5.Are these true or false?
num > 6
num >= 5
num != 6
num < 2
num == 4
!(num==3)
F
T
T
F
F
T
![Page 20: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/20.jpg)
Says: “Yes or no? I won’t
take anything else for an answer!”
![Page 21: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/21.jpg)
![Page 22: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/22.jpg)
Would you like some cake && ice cream?
![Page 23: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/23.jpg)
Depending on what you give them, the kid is either happy or sad.
True False
![Page 24: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/24.jpg)
&& =
&& =
&& =
&& =
Where’s my ice cream?
Where’s my cake?
Where’s my cake and ice
cream?
![Page 25: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/25.jpg)
Value 1 Value 2 Answer
T && T = T
T && F = F
F && T = F
F && F = F
And Truth Table
![Page 26: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/26.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
If x is 4 and y is 7...
(x>3) && (x<9)
![Page 27: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/27.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
If x is 4 and y is 7...
(x>3) && (x<9)= (4>3) && (4<9)
![Page 28: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/28.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
If x is 4 and y is 7...
(x>3) && (x<9)= (4>3) && (4<9)= T && T
![Page 29: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/29.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
If x is 4 and y is 7...
(x>3) && (x<9)= (4>3) && (4<9)= T && T= T
![Page 30: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/30.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
If x is 4 and y is 7...
(x>3) && (x<9)= (4>3) && (4<9)= T && T= T
![Page 31: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/31.jpg)
What can go in the recycling bin?
Paper || Plastic
![Page 32: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/32.jpg)
|| =
|| =
|| =
|| =
![Page 33: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/33.jpg)
Value 1 Value 2 Answer
T || T = T
T || F = T
F || T = T
F || F = F
OR Truth Table
![Page 34: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/34.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
If x is 4 and y is 7...
(x==3) || (y>9)
![Page 35: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/35.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
If x is 4 and y is 7...
(x==3) || (y>9)= (4==3) || (7>9)
![Page 36: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/36.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
If x is 4 and y is 7...
(x==3) || (y>9)= (4==3) || (7>9)= F || F
![Page 37: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/37.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
If x is 4 and y is 7...
(x==3) || (y>9)= (4==3) || (7>9)= F || F= F
![Page 38: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/38.jpg)
![Page 39: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/39.jpg)
! =
! =
![Page 40: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/40.jpg)
Value Answer
!T = F
!F = T
NOT Truth Table
![Page 41: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/41.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
Ans
!T = F
!F = T
If x is 4 and y is 7...
!(!(x<=7) && !(y!=9))
![Page 42: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/42.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
Ans
!T = F
!F = T
If x is 4 and y is 7...
!(!(x<=7) && !(y!=9))= !(!(4<=7) && !(7!=9))
![Page 43: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/43.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
Ans
!T = F
!F = T
If x is 4 and y is 7...
!(!(x<=7) && !(y!=9))= !(!(4<=7) && !(7!=9))= !(!T && !T)
![Page 44: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/44.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
Ans
!T = F
!F = T
If x is 4 and y is 7...
!(!(x<=7) && !(y!=9))= !(!(4<=7) && !(7!=9))= !(!T && !T)= !(F && F)
![Page 45: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/45.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
Ans
!T = F
!F = T
If x is 4 and y is 7...
!(!(x<=7) && !(y!=9))= !(!(4<=7) && !(7!=9))= !(!T && !T)= !(F && F)=!F
![Page 46: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/46.jpg)
Ans
T && T = T
T && F = F
F && T = F
F && F = F
Evaluate
Ans
T || T = T
T || F = T
F || T = T
F || F = F
Ans
!T = F
!F = T
If x is 4 and y is 7...
!(!(x<=7) && !(y!=9))= !(!(4<=7) && !(7!=9))= !(!T && !T)= !(F && F)=!F=T
![Page 47: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/47.jpg)
![Page 48: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/48.jpg)
![Page 49: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/49.jpg)
Some jokes.
![Page 50: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/50.jpg)
You can’t handle the truth!
![Page 51: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/51.jpg)
![Page 52: Boolean Algebragorskicompsci.ca/ICS2O/Unit2/ppt1_BooleanAlgebra.pdf · Operator Meaning > Greater than >= Greater than or equal to < Less than](https://reader030.vdocument.in/reader030/viewer/2022040610/5ed0c6878cc56e1a6b410288/html5/thumbnails/52.jpg)