Return to Scratch

Scratch Lab 7

Name: Miles Wiesenthal

Period: 7

Assignment: Lab #7

Lab Overview

This lab focused on blocks. Using our previous scratch knowledge, we learned how to compact and organize code using blocks. We also learned how to add parameters to blocks. One program I created was a box that would take in length and width, then calculate area and side length of a square and a triangle with that area. I also made a ruler that converts feet to miles and inches.

My Solution

To make the length and width box, the first part was pretty easy. I had a block with parameters of length and width. But finding the equilateral triangle was complex. I had to find a formula with algebra. The conversion problem was a little easier. I just tested if it was greater than 5280, and depending on the output, I sent it to different blocks. I used rounding and remainders to find miles + feet, instead of messy decimals.

Problem #4

Problem #2

Questions

  1. Blocks make it easier to debug/read, and they make your code more compact.
  2. Parameters are essentially variables inside the block, that are determined when the block is called.
  3. The formula for the area of a triangle would require two parameters, length and width.
  4. No parameters are needed if the block does not compute based on outside information; ie. it only is used to be activated it's set process at a certain time in the program.
  5. This block probably gets the name of something, inserts in into the list, then reorders the list, then continues. Blocks make this easier to understand because it is not a clump of code, It's more like a library, showing the titles, to get the jist, but you can go in further to get exact details. I would expect each block to do a process that corresponds to their title.