Scratch Lab 7

Distance Formula Revisited

Lab Overview

This lab required making a block that has 4 parameters that stand for xy coordinates. Upon running the program, one will receive thye distance between points

My Solution

I made a block points and defined it as saying the distnace formula with the xy coordinates. I then programmed the blocks to activate when the green button is clicked

Area of Rectangle

Lab Overview

The lab asked me to program the area of a rectangle, the length of the side of a square with the same area, and the side length of an equilateral triangle with the same area.

My Solution

I multiplied length times width for the area, I took the square root of the area to find the side length of a square, and I used geometry to relate the base to the height of the triangle and made that a formula to find the side length.

1. What are two advantages to using blocks for code repetition?

faster and smaller

2. What are parameters?

The things you plug in, such as booleans, strings, numbers.

3. Give an example of a formula that takes at least one parameter.

The area of a rectangle

4. Give an example of a situation where no parameters are needed

To move a sprite along the x or y axis

5. Explain what you think the following program does? How do blocks make this easier to understand? Explain what you would expect within each block.

The program will make a list in alphabetical until the list is complete.