Computer Science 15-100 (Sections T & U), Fall 2007
Class Notes, Day 8:   Tue 25-Sep-2007


Logistics

  1. Schedule
  2. This Week's Office Hours
  3. Reading

Topic Outline:

  1. Boolean expressions

    a)  Equality and inequality operators

    b)  Relational Operators  (<, <=, >, >=)

    c)  Logical Operators (!, &&, ||)

    d)  Truth Tables and Logical Operators

    e)  Short-Circuit Evaluation
     

  2. "if" Statements

    a)  The "if" statement

    b)  The "if-else" statement

    c)  Aside:  A Block { ... } is a Statement!
    See If Statement syntax diagram on p. 218

    d)  The "if-else-if-...-else" construct

    e)  Nested "if" statements

    f)  The "dangling-else" problem
     

  3. The Conditional Operator (?:)
     
  4. Switch Statements
    See syntax diagram on p. 232
     
  5. Comparing Data

    a)  Comparing Floats and Doubles

    b)  Comparing Characters

    c)  Comparing Objects (== versus .equals())

    d)  Comparing Strings with compareTo()
     

  6. The "while" Statement
    See syntax diagram on p. 235

    a)  Simple Example

    b)  Infinite Loops

    c)  The break statement

    d)  The continue statement

    e)  Nested Loops
     
  7. The "do" Statement
    See syntax diagram on p. 250
     
  8. The "for" Statement
    See syntax diagram on p. 253
     
  9. Iterators

    a)  Without "for" loops

    b)  With the new "for-each" loop
     
  10. Reading Text Files
     
  11. Comparing Loops (while, do, for)
     
  12. Drawing with Loops and Conditionals

Carpe diem!