65-lecture07 - Computer Science 65 Intro to CS February 14,...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science 65 Intro to CS February 14, 2008 If-Else Statements Loops
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Presentations February 14 Lance Berg GPS February 19 Computer Science Applications in Sports February 21 Tim Crane Robotics
Background image of page 2
Announcements If you did homework on lab machines, submit the homework by emailing me your .java file If you need an extension for homework #3, please talk to me Typically, homework receives a 10% late penalty a day Next programming assignment will be handed out on Tuesday
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Announcements For Tuesday Read Chapters 3.1-3.5 Read Chapters 4.2, 4.5
Background image of page 4
Logical Operators Java provides two binary logical operators ( and || ) that are used to combine boolean expressions. Java also provides one unary ( ! ) logical operator to reverse the truth of a boolean expression.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Logical Operators Operator Meaning Effect AND Connects two boolean expressions into one. Both expressions must be true for the overall expression to be true. || OR Connects two boolean expressions into one. One or both expressions must be true for the overall expression to be true. It is only necessary for one to be true, and it does not matter which one. ! NOT The ! operator reverses the truth of a boolean expression. If it is applied to an expression that is true, the operator returns false. If it is applied to an expression that is false, the operator returns true.
Background image of page 6
notes
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
boolean a = 4<5; boolean b = (5 == 3); boolean c; boolean d; c = a & b; d = a || b; && returns true when both a and b are _____ ; Otherwise, returns _______ || returns true when either a or b is _____; If both a and b are false , returns ______
Background image of page 8
Both operators, && ||, performs __________________________ The boolean expression on the left hand side of && (or ||) is evaluated first
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 36

65-lecture07 - Computer Science 65 Intro to CS February 14,...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online