Scratch Lab #7 Write Up

Name: Lexi Williams

Period: 7

Assignment: Lab #7

Lab Overview

This lab focused on blocks and parameters. I learned how to use blocks and why they are important and now learning them I realize they are a lot quicker and easier to find mistakes and they look better.

My Solution

My solution for this problem was creating a distance block with a feet parameter. I then had to define it and say if the feet are greater than 5280 inches then convert/change the answer into miles and if the answer was less than 5280 inches then the answer would be converted/changed to inches. I then had to create a code that used this and I had the sprite ask how many feet and then it would calculate the answer and tell me either inches or feet.

My Project Link

My solution to this problem was creating a block with perameters length and width. I had teh calculate the area of a rectangle and with that same area calculate the side lengths ogf a sqaure and triangle. I had to make two other blocks for the area of a sqaure with a variable set to find the sqaure root of the rectangle area and then created another block to find the triangle area with a variable being set to find the width by multiplying the area by two and then dividing that by the height to get the answer. After defining these blocks I created a code for this and when the dino asked what the length and width were and tehn use those answer to find trhe area of the rectangle. This area would then be used in finding the missing sqaure length and missing triangle width.

My Project Link

Questions

  1. What are two advantages to using blocks for code repetition?
    • You can see/find a problem in the code quicker and this allows for the problem or issue within the code to be fixed quicker it also makes the code look more elegant.
  2. What are parameters?
    • A parameter is an input given a specific code and when that parameter is used you can just plug in the parameter where it fits best and since there is already code for it, it will execute that code.
  3. Give an example of a formula that takes at least one parameter.
    • If you are trying to convert to feet or inches or any unit of measurement you need a parameter.
  4. Give an example of a situation where no parameters are needed
    • If you make a banana block and define it for example if I tell it to move ten steps and if it touches the edge then bounce and put a forever loop around that, I would just create a block with no parameters.
  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.
    • I think the following program will in the order given if a task is completed and is true then get name, inserting of list, recorder list, then continue will occur in that order.