Class Exercise:  Control Structures - if/else

Syntax
    if (booleanExpression) {statements}

    [else if (booleanExpression) {statements} ] ...

    [else  {statements}]

1.  One-Way Selection:
    Code an if statement to test a variable named richter representing the strength
    of an earthquake, and if it is true that the value of richter is less than 4.5,
    output the message "Expect little or no damage".




2.  Complex conditions:
    Construct an if statement that combines an expression for whether richter is equal
    8.0 or richter is greater than 8.0, and when one or the other is true will output
    the message "Most buildings will fall!".





3.  Compound (Block of) Statements:
    Enhance the "One-Way Selection" statement to execute two statements when the
    value of richter is less than 4.5: one to say "Damage may be light;";
    and another to say "I'm camping out though!";





4.  Two-Way Selection:
    Code an if .. else statement for the expression it is NOT true that richter is
    less than 4.5 then output the message "Poorly constructed buildings will be
    damaged", else output the message "Expect little or no damage".






5.  Multiway Selection:
    Construct an if .. else if .. else structure to implement the following
    mutually exclusive decisions:

    boolean expression        action when true (output)
    ------------------        -------------------------------------------
    richter = or > 8.0        "Most buildings will fall"
    richter = or > 7.0        "Many buildings will fall"
    richter = or > 6.0        "Some buildings will fall, others damaged"
    richter = or > 4.5        "Poorly constructed buildings damaged"
    richter < 4.5             "Expect little or no damage"