Week 4 – Working with Procedures in Scratch

This week’s assignment deals with procedures. Once a procedure is defined and coded it is placed in a custom block to allow a call of that procedure by inserting a block with that name into your other code. This reduces clutter in the main body of the program. It is also useful in teaching the used of called routines or functions in languages like C+, Ruby and Java.

We were to choose two problems from the book, find a solution to the problem then modify that code and possibly make it more useful.

For the first problem I chose problem 3. This is to created a procedure for converting °C to °F only. The procedure may be seen <HERE>.

The modifications I made were to make a calculator that converts both ways as shown below.

temp_conv_2

You make click the screenshot to see the code changes and use the converter.

Problem 5: Create a procedure to calculate the area of a circle based upon the radius. The procedure may be found <HERE>

My modifications to this were to make the calculator more useful by allowing the user to also calculate the circumference of a circle simply by selecting C for circumference or A for area. Click on the screenshot below to go to the calculator.

area_circum_calc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s