Scratch Lab #6 Write Up

Name: Lexi Williams

Period: 7

Assignment: Lab #6

Lab Overview

This lab focused on conditionals and using "if and of-else" statements. At first it was very hard to understand this concept but once I applied it and started coding with them I gained a better understanding of these statements.

My Solution

My solution for this problem was getting a bug sprite to draw when arrows were pressed. I had to use the pen and I set it to the size I wanted and then created several "if-then" statements to make the bug move a certain way when a certain arrow was pressed. I had to make sure that I had a key (the space bar) to clear the drawing when pressed and reset the bug to a central point. I also had to get the arrow keys to point in a certain direction when pressed and change the (x,y) by the given integer.

My Project Link

My solution to this problem was setting the letters to -1 in order for the dinosaur to start at "A" when it starts to spell the words back. When the green flag is clicked the dinosaur would ask for a word but now the conditional comes in and if the word is less than 10 letters the dino will spell that word back however, if the word is greater than 10 letters the dino will ask for a new word to spell. I used the "if-then-else" statement to get this result.

My Project Link

Questions

  1. What is the difference between and if and and if-else statement?
    • An "if" statement has only one outcome whereas an "if-else" statemetn has two outcomes.
  2. Is there a simpler way to write the following code? Explain.
    • Yes, you would have to put in a "not" statement. So, if the mouse is not equal to sero then it will just move 10 steps but if the mouse x does equal zero then it will move 10 steps and say "My mouse is at zero!"
  3. 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…”
    • Someone who is in band or is a Freshmen, Sophomore, or Junior on the soccer team.
  4. 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…”
    • If you are a Freshmen, Sophomore or Junior, or you are a senior and you play soccer or are in the band then this applies to you.
  5. Write the condition for a number being a multiple of 15. (hint: look "mod" at the block).
    • Set a number equal to a variable and put that variable into the first part of the mod and then 15 in the second part of the mod and the answer will come out and will give the remainder also.