teaching machines

CS 145 Lecture 11 – Relational Operators

Agenda

  • what?s
  • methods in other languages
  • relational operators
  • logic in Scratch

TODO

  • Compose on a 1/4 sheet two or more questions that might appear on Monday’s quiz. Bring them to lab and share one of them during lab in a mini-review.

Code

Relational.java

package lecture0926;

public class Relational {
  public static void main(String[] args) {
    // int age = 120;
    // boolean isEligible = (age >= 62);
    // System.out.println(isEligible);
    
    // int nBalls = 5;
    // boolean isWalk = (nBalls == 4);
    // System.out.println(isWalk);
    
    // int nSpouses = -1;
    // boolean isPolygamous = nSpouses > 1;
    // System.out.println(isPolygamous);
    
    // int secret = 17;
    // int guess = 17;
    // boolean isWrong = guess != secret;
    // System.out.println(isWrong);
    
    // double bac = 0.0799999999;
    // boolean isLegal = bac < 0.08;
    // System.out.println(isLegal);
    
    String name = "Demosthenes";
    int nFingers = 11;
    boolean isTattoable = name.length() <= nFingers;
    System.out.println(isTattoable);
  }
}

Haiku

on mixed bags:
Big looked at Little:
You’re not 0; I’m not MAX
That makes us equals

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *