Lab #4

Name: Flavia Rodrigues

Period: 7

Assignment: Lab #4

Lab Overview

In this Lab, we had to work with different sets of variables. We were meant to change the variable and use what if statements to help us. I learned how to use the broadcast command,one that ihad failed tolearn during the last project we did.

My Solution, Problem #1

On this solution we were meant to change the speed of the dancing girl. We had to make her dance faster or slower.We did this by connecting her speed to a variable. I had trouble with this because I could not figure out how to make my sprite dance fatser, she would only go slower.

My Project Link

My Solution, Problem #2

For my second solution I had to ask a person a bunch of question with my sprite but then my sprite had to have a conversation with another sprite. I could not figure out how to save different answers for the questions. My answer for the previous question would continue to get overridden by the next answer.

My Project Link

My Solution, Problem #4

For the last problem, we had to make the sprites dance to music, but then if the music got too loudthesprites would have to run away fromthe cops. The volume of the music had to be controlled by a certain sprite.

My Project Link

Questions

1. Are variables in computer programming the same as variables in math class? Why or why not?

The variables in the compuer programming are not the same as the one in math class even though they are similar. In computer programming, the variables don't have to represent just numbers they can represent other things as well.

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)

The variable can affect just on sprite or it can affect all the sprites.

3. How many values can a variable store at one time?

A variable can store one value at a time.

4.What will the following code snippet do? Explain why it doesn’t work as intended.

Its intended to switch the variables. It doesn't work beacuse since you change value_1 to value_2 then value_2 to value_1, they will end up being the same value because they were done in a certain order. The value of value_1 gets lost.

5. Given the following code snippet, explain what is happening.

This does what the previous code wanted to do. It saves the value of value_1 before it can be overridden