###Teacher Preparation
- A further understanding of Scratch. Teacher should be familiar with sensing, control, operator and data blocks.
- Students will be able to create and implement a variable in a Scratch program.
- A variable, like the variables you use in math class, is a placeholder for a changing value.
- Variables are like boxes; they store something.
- Variables have a name and a value.
- Students will created a program in Scratch that can calculate the area of a rectangle.
- Variable
- http://scratch.mit.edu, use the "Create" tab
- Volunteer takes attendance. Procedure found here.
- Students will be asked to answer the question below on paper:
"Can someone tell me how you have used variables in other classes?" Tell the students how using variables in programming is very similar to using variables in math class. Cover the key points of this lesson:
- A variable, like the variables you use in Math class is a placeholder for a changing value.
- Variables are like boxes; they store something.
- Variables have a name and a value.
Slowly create, while asking questions from student volunteers, a “Hello, Name” program on the board. Students should be watching and answering questions that the teacher is asking during the demonstration.
“We have just created a program that can say hello to you. However we did not use a variable. Let’s remake this program, but this time using a variable called . Just like how we used variables we we wrote out the MadLibs game.
The students should follow along as the following program is created.
Hint: You can create your own variable in the "Data" section of Scratch.
Using the knowledge you just learned from creating the hello program, create a program that can calculate the area of a rectangle. Step-by-step instructions are listed below but students are encouraged to create this program on their own if they would like the challenge.
- The program must first ask the user for the width of the rectangle.
- Store that user input in a variable called "width"
- Repeat steps 1 & 2 for the rectangle's height.
- Create a third variable called "area"
- Using the Operators block, set the "area"" variable to the product of
- Now you can use the Say block to have Scratchy tell the user the area of the rectangle.
"Today we covered the basics of using variables when writing your own program."
For homework, students will create a program that calculates the area of a circle.
- Take a quick look at each Scratch project from today. Students who were not able to create the program should be asked to recreate the project, with teacher’s help, next class.
- Prepare for next lesson / hand off to next volunteer in rotation.