Design. Program.Create

Coding In Math

Scratch Coding projects in Math class

Add a bit of coding to your math class. Add just one lesson!

Why coding in Math class?

  • Coding a math project helps reinforce the steps to solve a problem - Instead of the student executing the algorithm (the steps) to do a specific math problem, they will learn to abstract and write code to solve ALL problems of that type. This helps reinforce the steps to solve a math problem. Example: Instead of calculating the area of a rectangle for some given dimensions, create a Rectangle calculator to find the area of ANY rectangle based on user input of dimensions.

  • Students will ‘Play’ with math as they change variables, co-ordinates and more to make a coding project work - it is the best hands-on experience to understand math while having so much fun.

  • It relates math to something most students enjoy - working on/ with computers.


Some Math-Coding connections

There are so many - but here are some that you will see right away as they work on these coding projects

  • Positive/negative numbers : are used in code to denote the direction/ distance moved, just like a number line

  • Co-ordinates - x/y positions are used to denote where on the screen an item is placed

  • % values - is used to denote relative size of items, is it the original 100 % or only half as big (50%)

  • Variables - are a placeholder for any value. ( NOTE in coding, we use any name for a variable, not just letters like x , y )

  • Geometry - shapes are created on the screen based on numbers/angles

  • Functions - based on inputs, a function is a piece of code that is used to compute a final output


Lesson Plan and ready-to-go Scratch Projects

Lesson Plan

  1. (Optional) : Explain that code is just executing a series of steps (an algorithm). When we solve a math problem, we follow steps/ execute an algorithm. We can use code to solve any math problem.

  2. Ask students to open the link at https://scratch.mit.edu/studios/3554710/ or select one project and share that link. Students do not need Scratch accounts or have to REMIX, let them experiment and just make it work.

  3. Assign them one or more projects or let them choose one.

  4. Ask students to work alone or with a partner on the project. Instructions are included in the project both on the Scratch project page and as comments in the code. There are hints as well as code blocks that may be needed to help the students.

  5. Ask students to reflect at the end of the class -which ones did they solve, what was challenging, how does this differ from doing it in math class.

Scratch Projects Studio : https://scratch.mit.edu/studios/3554710/projects/

Teachers please email me for solutions and other hints/tips for these projects.

Project Information

Project 1 : The Change Calculator Cat

The Change Calculator cat asks the user to set the total cost of items and sales tax percentage. It calculates how much change to return based on the bill given ($10, $20 or $100)

Project 2: The Rectangle Calculator Cat

The Rectangle Calculator cat lets the user set length and width using sliders and then draws the rectangle when they press Space. Finish the project by calculating the area and perimeter values also when the user presses the Space key

Project 3: The Unit Converter Cat

User enters the number of inches. When user clicks on the cm button, the converted amount in cm shows up next to the button.

Add code to make this work. Add code for the feet button to work. Add other buttons for miles, km and other units of length

Improve the user interface so this Unit Converter is easier to use for all kinds of conversions

Project 4: The Geometry Cat

The Geometry cat can make any shape. Use slider to set the number of sides and click on the cat. Press space to clear the screen.

Currently the cat can draw a square using the given code. Modify the code to make it draw a hexagon or an octagon? Can you find the formula so it can draw ANY shape and change the code so it works with the slider?

Project 5: The y = x + c graph Cat

Currently this cat always draws the line for y = x

Change the code so it draws a line for y = x + constant

where user can change the constant using the slider.

(optional) Can you have the cat draw each line in a different color.

Project 6: How many minutes left ?

The cat gives the current time at the user's location. Add code so when user clicks on the cat, it tells how many minutes left to the top of the hour (i.e till the next hour starts)

Project 7: The distance formula calculating Cat

Cat starts at a fixed place and then draws a line to the mouse pointer Add code to calculate the length of the line using the distance formula.

(Optional : Calculate the area of the the pythagorean triangle drawn by the cat and have the cat say it at the end)

Project 8: The Cat Timer

Make a cat timer. When user presses on the cat, the cat counts down - and then when the time is over, it changes color/ makes a sound or says time is over...

Version 1. Make a 30 second timer where there is no way to see the count is going down (slider value does not change, cat does not say anything).

Version 2 ( extra challenge) , let the cat say ' 3, 2, 1...' show the counting as time counts down and even have the slider value show the change.

Version 3: Make it even better. Let user select the timer using the slider. Add sound, a button to stop the timer, or start the timer.

Project 9: The Shopping App

Finish the shopping app where the user clicks on the item to add it to the cart and the price updates automatically.

If the user clicks on Empty Cart, all items go to 0.

Start by making the total cost change based on the number of hats. Then add variables for the other items. Change the items and prices and make this a better project.

Project 10: The Cylinder Calculator Cat

Add code to calculate the volume of the cylinder

Optional: Add code and text to show the surface area.