Scratch Lab 7 Write Up

Name: Olivia Moore

Period: 7

Assignment: Scratch Lab #7

Lab Overview

This lab was based on blocks and using parameters to eliminate the use of unwanted variables. We were to complete 2 out of 4 problems to code with multiple parameters in blocks to find the area of a rectangle with measurements given by the user, give the side length of a square with the same area, and with an equilateral triangle. Also, we used the distance formula and parameters to give the distance of one point to another given by the user. We worked with blocks we named and parameters making the code easier to read. The full lab description is found HERE.

My Solution

My solution is to use blocks that give the area of a rectangle with given measurements by the user and use the distance formula for points given by the user. I did this by using multiple parameters. For the rectangle, I used 2 parameters, length and width, and I used 4 parameters, x1, y1, x2, and y2, for the distance formula. After inserting conditionals and formulas, the code spat out the correct answers like magic! At least with the magic of computing technology. Blocks and parameters make codes be more customized and better organized to get a sprite or program to do what you want.

My Project Link

Questions

  1. The code is performed more smoothly and the computer performs more quickly. It's easier to debug as well since it's better organized.
  2. A parameter is a type of input variable within a block that can decrease the number of extra variables.
  3. Finding the area of a rectangle with given measurements uses two parameters A=l*w.
  4. If a sprite were to turn around on the screen, then I would use a block "back" that moves -10 steps and turns 90 degrees counterclockwise.
  5. I think it will get a name that the computer asks, store it, put it into a list that is definied somewhere else, rearrange the list to suit the requirements the coder wants, and continue with the rest of the code the coder wants. The code is better organized and lets the coder read it easier. They are named simply and tells what the task is and they are defined elsewhere.