Conditionals and Introduction to Methods

New Terminology

Defensive programming
A programming strategy that assumes that something can go wrong, no matter how careful we are.
Scope
In programming, the extent to which a variable or method is visible to users of that variable or method.

Programming specific structures and terms

nested if
An if/else statement that is inside another if/else structure.
cascading if
An if/else series that provides one true based on a series of conditions.
range
Using a boolean expression to test for a range of values (from loval to hival)
switch
A decision structure consisting of an expression and then a list of possible values for that expression with the action to take if the value matches.
break
A statement that causes execution to resume following the structure in which it is found.
scope
In Java, block scope is the norm for all variables.

Class notes

  1. Homework review - think, pair, share any that you still have trouble with.
  2. Review for Wednesday, what are you ok with?  What do you specifically want to review?
  3. Lab Review - MakingCircles.java and Circle.java
  4. Review of Logical Operators and Nested ifs 
    1. nested if (cascade) - TestResults.java
    2. nested if (one branch) - LoanQualifier.java
    3. logical AND - LogicalAnd.java
    4. logical OR - LogicalOr.java
    5. comparing characters and Strings - StringCompare.java
  5. Switch statement - SwitchDemo.java
  6. An intro to scope - VariableScope.java and Circle.java