CS 145 Lecture 13 – Logical Operators
Agenda
- what ?s
- blackboxes
- logical operators
- some problems
TODO
- Finish homework 2.
Note
For each of the following blackboxes, let’s consider what they accomplish and how relational operators enter in:
Using the logical operators, let’s write some methods that tell us if…
- someone will get blisters from playing in wild parsnip
- someone is Mr. Right
- a file is an image
- one can sleep in today or not
- a String is non-blank
- a String is ALL CAPs
- a String is mixed case
- a slicing of a pizza may yield an even split for either 3 or 4 people
Code
LogicKing.java
/usr/lib/ruby/2.7.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'coderay' (>= 0) among 56 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/.gem/ruby/2.7.0:/var/lib/gems/2.7.0:/usr/lib/ruby/gems/2.7.0:/usr/share/rubygems-integration/2.7.0:/usr/share/rubygems-integration/all:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0:/home/johnch/.gems', execute `gem env` for more information from /usr/lib/ruby/2.7.0/rubygems/dependency.rb:323:in `to_spec' from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:62:in `gem' from ./coderay:24:in `'
Haiku
Parenting pro-tip
Do you want to leave right now?
Or in five minutes?
Do you want to leave right now?
Or in five minutes?