Lab #6 Write Up

Name: Kelly Yokoi

Period: 7

Assignment: Lab #6

Lab Overview

Scratch Lab #6 focused on conditionals in scratch. For problem #1 I had to make an etch a sketch using "if..then" blocks. For Problem #2 I had to make a sprite's costume change and have the program record the fastest rate it changed.

My Solution Problem #1

I set the sprite to start at the origin and then put multiple blocks in a forever loop. In this forever loop I put the pen down so the sprite could draw a visible line. Then I had 4 if...then blocks for each arrow key. For each of these conditionals I had them point in the appropriate direction and move ten steps whenever the corresponding arrow key is pressed. Then I used an event tag which made it so if the space key is pressed the sprite would return to the origin and the screen would be cleared.

Problem #1

My Solution Problem #2

For Problem #2 I created three sprites: two buttons and a character with multiple costumes. I also made a variable named "speed." For the character I set "speed" to 0.5 and in a forever loop had that be the number of seconds in between each costume change. For the faster button I had it set "speed" to "speed-0.1" so that the time between each costume change would be shorter and the animation would look faster. For the slower button I had it set "speed" to "speed+0.1" so the time between each costume change would be longer and the animation would look slower. To record the maxspeed

Problem #2

Questions

  1. Question #1-Control Structures

    What is the difference between and if and and if-else statement?

    • The if-else statement is more specific. If statements don't specify what should be done when the conditional turns out to be false where as if-else does.
  2. Question #2-Simpler version?

    Is there a simpler way to write the following code? Explain.

  3. Question #3-Compound Conditionals

  4. Which students are described by the following conditional? “if you are not a Senior and you are on the soccer team or you are in band then…”

  5. Question #4-Compound Conditionals 2

  6. If the statement from Question 3 is changed as shown below, who else is included in the condition? “if you are not a Senior OR you are on the soccer team or you are in band then…”

  7. Question #5-Nested Conditionals

  8. Write the condition for a number being a multiple of 15. (hint: look at the block).

Click HERE to return to homepage.