## Summary:

Students debug a program that is designed to calculate the volume of any size rectangular prism. This program uses variables and the ask and wait block to allow user input for the length, width, and height of the prism. Then it should calculate the volume of any rectangular prism, but there is a bug in the program. Students will debug the program.

## Materials:

- Volume L x W x H Scratch activity (student version)
- Volume L x W x H Scratch activity (teacher version)
- If needed, Finding Area Scratch activity
- If needed, Volume and Surface Area Scratch activity
- If needed, Missing Height of a Prism Scratch activity
- Screencast Tutorials
- Classroom computer and student computers

## Programming Skills with Scratch:

- Create, name, use, and set the values of variables
- Use the ask and wait block and the answer block
- Debug a script
- Nest multiplication blocks into a join block
- Scratch blocks used: (ask and wait, answer, variables, set variable to, join, multiplication, say)

## Lesson:

- Open and run the Scratch activity
*L x W x H Copy*several times. - Be sure students know how to create, name, and set a variable.
- Click Data category.
- Click Make a Variable.
- Name the variable. Make sure to use a name that clearly explains what the variable represents.
- Click For all sprites.
- Click ok.
- The variable will appear on the stage. Right click the variable shown on the stage. There will be a drop down menu that allows you to select the type of readout the variable will have on the stage. Try all of them. This activity uses the large readout.
- Set the value of a variable by using the set variable to block from the Data category. Use the drop down menu to find the name of the variable you want to use.

- Make sure students know how to nest a join block and multiplication blocks into a say block. (Watch the first screencast tutorial.)
- Open the Volume L x W x H Scratch activity (student version). Explain that this activity does not work. It does not correctly give the volume of any rectangular prism. It has bugs in it. Students need to debug it.
- Decide if students should work with a partner or individually.
- Allow time for students to open, remix and debug the script so that it works correctly.

## Extensions:

- Allow time for student to make a generalized script that would solve a problem such as this:
The volume of a rectangular prism is 24,000 cubic feet.

The length of the prism is 30 feet.

The width of the prism is 20 feet.

What is the height of the prism?

Example Volume Script - Let students explore Finding Missing Height of Prism Scratch activity.
- Let students examine the Finding Area Scratch activity. There are problems with this project. It does not correctly find the area of a square, a rectangle, or a triangle. Debug the project and fix the scripts so that it gives the correct area for each figure.
- When students have their script working properly, ask them to add script so that the program will not only tell the volume of any rectangular prism, but will also tell the surface area of the prism. Example Volume and Surface Area Script

## Common Core:

5.MD.C.3, 5.NBT.B.5

## CT/CS Standards and Skills:

CS-Solve problems by decomposing them into smaller parts, Debugging

CT-Work with variables, Use logical reasoning to explain how some simple algorithms work

These lessons were written by Judy Rocke based on lessons developed at Kenwood Elementary School in the Champaign Unit 4 school district. Funding was provided by the National Science Foundation under award number 1542828. These lessons are intended to be used alongside the EM-4 curriculum.

Lessons prepared as web documents in Summer 2017. Contact us for updated lesson plan materials.

Lessons prepared as web documents in Summer 2017. Contact us for updated lesson plan materials.