teaching machines

CS 145 Lecture 13 – Logical Operators

October 2, 2015 by . Filed under cs145, fall 2015, lectures.

Agenda

TODO

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…

  1. someone will get blisters from playing in wild parsnip
  2. someone is Mr. Right
  3. a file is an image
  4. one can sleep in today or not
  5. a String is non-blank
  6. a String is ALL CAPs
  7. a String is mixed case
  8. 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?