Day 6 - Selection (Conditionals)
Day 6: Selection (Conditionals)
Learning Objectives
- AAP-2.E: For relationships between two variables, expressions, or values: Write expressions using relational operators.
- AAP-2.F: For relationships between Boolean values: Write expressions using logical operators.
- AAP-2.G: Express an algorithm that uses selection without using a programming language.
Essential Questions
- How do programs make decisions based on conditions?
- How can we use conditional statements to control program flow?
Materials Needed
- Presentation slides on selection statements
- Programming environment
- Conditional statement worksheets
- Flowchart templates
- Exit ticket templates
Vocabulary
- Selection
- Conditional statement
- Boolean expression
- If statement
- If-else statement
- Branching
- Control flow
- Decision
- Block
Procedure (50 minutes)
Opening (8 minutes)
-
Review and Connection (3 minutes)
- Review algorithm design and testing from previous lesson
- Connect to today's focus on making decisions in programs
-
Warm-up Activity (5 minutes)
- Present a real-world scenario that involves decision-making
- Ask students to describe the decision process in their own words
- Discuss how decisions can be represented as yes/no questions
Main Activities (32 minutes)
-
Lecture: Selection Statements (12 minutes)
- Define selection as a programming construct that executes different code based on conditions
- Explain the structure and syntax of conditional statements:
- IF (condition)
- IF (condition) { statements } ELSE
- Discuss Boolean expressions as conditions that evaluate to true or false
- Explain how relational operators (=, ≠, >, <, ≥, ≤) are used in conditions
- Show how the program flow changes based on condition evaluation
- Demonstrate the execution of IF and IF-ELSE statements with examples
- Explain the concept of blocks of statements in conditionals
- Discuss common use cases for conditional statements
-
Demo: Implementing Decision-Making in Code (8 minutes)
- Walk through examples of programs that use conditionals:
- Determining if a number is positive, negative, or zero
- Checking if a user is eligible for a discount
- Validating user input
- Implementing game logic
- Show how to trace the execution of conditionals step by step
- Demonstrate how different inputs affect the program flow
- Highlight common mistakes in conditional statements
- Walk through examples of programs that use conditionals:
-
Hands-on: Writing Programs with Conditional Statements (12 minutes)
- Students work in the programming environment
- Guide students through creating programs that use conditionals
- Have students implement programs for scenarios like:
- Determining if a year is a leap year
- Calculating grades based on scores
- Implementing a simple calculator with different operations
- Creating a simple game decision
- Encourage students to test their conditionals with different inputs
Closing (10 minutes)
-
Activity: Creating a Simple Decision-Making Program (5 minutes)
- Students design and implement a program that makes decisions based on user input
- The program should use both IF and IF-ELSE statements
- Students should test their program with various inputs
- Share and discuss different approaches
-
Exit Ticket and Preview (5 minutes)
- Students complete a program that uses conditional statements to solve a problem
- Preview that next class will focus on Boolean logic and compound conditions
Assessment
- Formative: Quality of conditional programs during hands-on activities
- Exit Ticket: Correctness and effectiveness of conditional program
Differentiation
For Advanced Students
- Provide more complex decision scenarios
- Introduce the concept of nested conditionals
- Challenge them to optimize decision structures
For Struggling Students
- Offer more structured templates for conditional statements
- Provide flowcharts to visualize decision-making
- Focus on simpler conditions before moving to complex ones
Homework/Extension
- Complete a worksheet with conditional statement exercises
- Create a program that implements a more complex decision-making scenario
- Research how conditionals are used in real-world applications
Teacher Notes
- Emphasize that conditionals change the sequential flow of program execution
- Watch for common syntax errors in conditional statements
- Make connections to algorithm design and how conditionals implement decisions
- Consider using physical demonstrations to show branching paths
- Remind students that selection is one of the fundamental programming constructs