CRD-2.C.1 Program inputs are data sent to a computer for processing by a program. Input can come in a variety of forms, such as tactile, audio, visual, or text.
CRD-2.C.2 An event is associated with an action and supplies input data to a program.
CRD-2.C.3 Events can be generated when a key is pressed, a mouse is clicked, a program is started, or any other defined action occurs that affects the flow of execution.
CRD-2.C.4 Inputs usually affect the output produced by a program.
CRD-2.C.5 In event-driven programming, program statements are executed when triggered rather than through the sequential flow of control.
CRD-2.C.6 Input can come from a user or other programs.
CRD-2.D.1 Program outputs are any data sent from a program to a device. Program output can come in a variety of forms, such as tactile, audio, visual, or text.
CRD-2.D.2 Program output is usually based on a program’s input or prior state (e.g., internal values).
AAP-2.F For relationships between Boolean values:
a. Write expressions using logical operators.
b. Evaluate expressions that use logic operators.
AAP-2.L Compare multiple algorithms to determine if they yield the same side effect or result.
AAP-2.I For nested selection:
a. Write nested conditional statements
b. Determine the result of nested conditional statements.
The objective for this lesson is to use keyboard input events to identify console output using conditionals. Activity 1 will introduce keyboard input events using the EarSketch API function readInput and apply conditionals with Logical Operators to identify console outputs based on user choices. Activity 2 will compare Logical operators and Nested If statements to identify when they yield the same results.
Activity 8.1.1 (55 minutes)
Facilitate students’ discussion on the Burger King commercial on “Have it your way” relating to conditional algorithms (PowerPoint slide 2).
Facilitate PowerPoint to explore reading input from the console and data type conversion (Powerpoint slides 3-6, Archived EarSketch Chapter 17.1 (Console Input and Conditionals)).
Have students walk through EarSketch Chapter 17.1 code exercise “Musical Console Input” to prompt users for tempo input (PowerPoint slide 6).
Present PowerPoint and video explaining arithmetic operators, Boolean logic, Boolean operators, and conditional statements (PowerPoint slides 7-10, Archived EarSketch Chapter 17.2 (Booleans) and 17.3 (Conditional Statements)).
Complete Choose your Change MiniTask (PowerPoint slide 11).
Activity 8.1.2 (55 minutes)
Facilitate students’ discussion on the client they chose and how they can use pitch for the mood of their client.