Name: Colin Yang

Period: 7

Assignment: Lab #6

Lab Overview Problem #1

This lab asked us to make a etch-a-sketch program on scratch using the four arrow commands controlled by the user.

My Solution

My solution included a forever loop with five different if statements inside the forever loop. Once the green flag is clicked, the sprite will switch to costume 1 (facing the right side of the screen). The variable direction is set to five, the pen is then placed down, and if the space key is pressed, the pen is lifted up, the sprite goes to coordinates (0,0) and the screen is cleared. If the up arrow key is pressed, the sprite switches to costume 2 (facing the top of the screen) and change the y coordinate by the variable direction. If the down arrow key is pressed, the sprite switches to costume 4 (facing the bottom of the screen) and change the y coordinate by the variable direction times negative one. If the right arrow key is pressed, the sprite switches to costume 1 and changes the x coordinate by direction. Finally, if the left arrow key is pressed, the sprite switches to costume 3 (facing the left side of the left side of the screen) and changes the x coordinate by direction times negative one.

My Project Link

Lab Overview Problem #3

This lab asked us to have the sprite spell out a word that is given by the user. If the word is longer than ten letters, the sprite will ask the user to give it a shorter word.

My Solution

My solution involved a sprite that would ask the user "Give me a word to spell!" as soon as the green flag is clicked. Then, an if else statement was used, with the condition being if the length of the answer is greater than 10, then it will ask the user "Give me a shorter word to spell!". If the word is shorter than 10, it will say each letter of the answer for two seconds.

My Project Link

Questions

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

An "if" statement allows the sprite to do a certain thing only if the "if" statement is true. An "if-else" statement allows the sprite to do a certain thing if the the "if" part of the statement is true, and apply the "else" statement if the "if" part of the statement is false.

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

The user can put the entire code in a forever loop, but take out the move 10 steps part and put it before the if statement. In addition, the user can also make the code into just an if statement rather than an if-else statement.

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…”

People that are either freshman, sophomore, or juniors that play on the soccer team, and people that are in band.

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…”

People that are not seniors, people that are on the soccer team, and people that are in band.

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

The user would put in any number in the first circle of the mod block and put 15 in the second circle. Then, the entire mod block with both of the numbers is placed in an if statement that asks "if the *number that user chooses* mod 15 is equal to 0, then the answer is a multiple of 15."