Scratch Lab #4

Name: Yohannes Dagne

Period: 7

Assignment: Lab #4

Lab Overview

Create a simple animation using the built in costumes for any sprite you choose. You should use a forever loop so that the animation won’t end. Add another sprite to act as a button. Name this sprite “Faster”. Add another sprite that also acts as a button. Name this sprite “Slower”. Using a variable called “speed”, have the faster button speed up the animation and the slower button slow it down. Build a program where a sprite asks for name, grade, favorite activity, and favorite food. The sprite should then have a ‘conversation’ with another sprite (who wasn’t on the screen until now) about the cool person they just met. Write a program that takes two ordered pairs of points and calculates the distance between them. Hint: You might want to use 4 variables. Test your program with a known distance. For example, the ordered pairs (2, 3) and (5, 7) should have a distance of 5 units.

My Solution

I completed the required tasks that each problem asked me to do.

Prob. 1

Problem 1

Prob. 2

Problem 2

Prob. 3

Problem 3

Questions

  1. Are variables in computer programming the same as variables in math class? Why or why not?
  2. If you are given a situation where you want an action to repeat, but you don’t know how long it should repeat for, which loop is the best structure to use? Why?
    • You can use a forever loop and have the sprite do it's action forever.
  3. Does the following loop structure work? Does it make sense? Why or why not?
    • The loop structure works. IOt has the sprite say something forever in 0.2 second intervals.
  4. How can sprites “know” when to begin an action? Is there more than one way?
    • You give it a start with the when "green flag" clicked button is clicked.
  5. Are the following code snippets equivalent? Why or why not?
    • TThey essentially are different in code but do the same action.