Unit 3-03

Learning Outcome

At the end of this lesson, you will be able to:

  • understand and use an if ... then ... else statement

Review

  • if ... then ... else statements

Lesson

  • go over "if ... then ... else" and "Compound Boolean Expressions", Chapter 3
    • Computer Based Problem Solving

Activity

  • null

Daily Assignment

  • we will be working on this next day as well since it is quite a complex problem
  • create a "Rock, Paper and Scissor" program
    • use a "random Class" to generate a random number between 1 - 3 for the computers choice
    • use a 3 level If...Then...Else... Statement to see who wins( 3 possible choices win, lose, draw)
      • there are 9 different combinations though
        • but three are if both are equal, so that is an easy one
    • each Boolean expression will be a compound
      • except for when it is a tie
    • ENSURE you think about this BEFORE you start to program, or you will get nowhere!
      • that means a design document
        • top-down
        • flow-chart
        • pseudo-code

Extra

  • create the above program in a second language

Homework!

  • read over "nested if statements", Chapter 3
    • Computer Based Problem Solving