Lab Write Up

Name: Arman Williams

Period: 7

Assignment: Lab #3

Lab Overview

This lab focuses on variables and questions in scratch, and using different answers or buttons to change variables and get responses. A side note is also using simple mathematic equations to change outcomes. A full lab overview can be found HERE.

My Solution

I created a project that asks how fast an object moves, then uses the answer as a variable to set how many coordinates it moves per tick. For assignment 1, I set buttons to change a variable which was subtracted from a set number for each time the costume would wait inbetween changes. For assignment 2, I had a sprite ask multiple questions and set those answers to different varibles, then plugged them into a conversation. For 3, I did the same thing, except plugged the numbers into the distance equation instead of a conversation. For 4 I made two buttons that changed volume and a varible for sound, which if it got too high, would show a hidden sprite. For 5 I used a converter to find conversaion rates and then divided to match up and add the results from inches and feet.

My Pair project

Assignment 1

Assignment 2

Assignment 3

Assignment 4

Assignment 5

Questions

  1. Are variables in computer programming the same as variables in math class? Why or why not?
    • Yes, because they both are something that can be changed, or "vary" depending on inputs.
  2. When creating a variable, what are the two types of scope a variable can have? That is, what can it affect. Think about your options as you make a variable
    • It can affect either all sprites, or just the one sprite selected.
  3. How many values can a variable store at one time?
    • Only one.
  4. What will the following code snippet do? Explain why it doesn't work as intended
    • It's meant to switch the variables, but it makes both of them the same as value 2, because value 1 becomes value 2, which is then supposed to become value 1, but value 1 already changed to value 2, so it stays the same.
  5. Given the following code snippet, explain what is happening.
    • Temp becomes value 1, then value 1 becomes value 2, and value 2 becomes value 1, since the temp became value 1 already.