1. User Errors
    1. robust programs
      1. a prog can deal with illegal data
    2. Scanner Lookahead
      1. hasNextInt();
      2. hasNextDouble();
      3. hasNextString();
    3. The prompt and error detection leads to "fencepost"
  2. Assertions and Program Logic
    1. provable assertion
    2. Reasoning about Assertions
      1. Program verification
  3. case study(write)
  4. The boolean Type
    1. statements
      1. boolean text1 = true;
      2. test1 = text2
      3. test 3 = (3*100 < 250);
    2. logical operators
      1. NOT
      2. AND
      3. OR
    3. Short-Circuited Evaluation
      1. avoid exception
        1. while(stop < s.length() && s.charAt(stop)==' ')
    4. Boolean Variables and Flags
      1. boolean variable=>assign a name
      2. flag
        1. track the variable
    5. Boolean Zen
      1. simplify boolean expression
      2. De Morgan's laws
        1. p||q = !p&&!q
  5. Fencepost Algorithms
    1. Add initial output outside the loop
      1. if/else to this initial
      2. or double test
    2. Sentinel Loops
      1. end input signal
  6. The while loop
    1. indefinite loops
      1. update step
    2. scope of variable
    3. pseudorandom numbers
      1. Math.random()
      2. Class Random (in java.util)
        1. nextInt(10);
        2. nextDouble();
        3. nextBoolean()
      3. save the random, if use again
    4. Priming a loop
    5. do..while
      1. adapt to the prog you know you want to exe at least once