PDA

View Full Version : Finally hit a wall.

ChrisDavidson
07-14-2013, 02:12 AM
So I am currently working on the Chapter 2 exercises and am having some trouble with a few questions.

2.3 In frog world the distance variable was declared locally in the hop method. What does this imply.

My best answer and I don't feel it is right is "This implies that both of the methods are based on one distance variable."

Now here are the two that I have been trying to wrap my mind around for the past two hours.

2.4 Write a statement that moves an object called car forward a distance equal to three times the value of the variable total.

“car-move forward-6meters-duration=distance seconds”

I strongly feel like it is correct as the variable distance is 1/3 of the total. But the way I understood it, is the governing total of distance is set in the top variable. So if the top variable is distance=5, then all methods set to that variable will add up to 5. I hope that made sense.

Lastly and this might be the reason I just go to bed and pick it up fresh tomorrow.

2.5 Write a statement that sets the value of a variable called length to one fourth of the value currently stored in the variable height.

Not looking for answers just help understanding this. Thanks in advance.

JasonEllis
07-14-2013, 04:01 PM
So I am currently working on the Chapter 2 exercises and am having some trouble with a few questions.

2.3 In frog world the distance variable was declared locally in the hop method. What does this imply.

My best answer and I don't feel it is right is "This implies that both of the methods are based on one distance variable."

Now here are the two that I have been trying to wrap my mind around for the past two hours.

2.4 Write a statement that moves an object called car forward a distance equal to three times the value of the variable total.

“car-move forward-6meters-duration=distance seconds”

I strongly feel like it is correct as the variable distance is 1/3 of the total. But the way I understood it, is the governing total of distance is set in the top variable. So if the top variable is distance=5, then all methods set to that variable will add up to 5. I hope that made sense.

Lastly and this might be the reason I just go to bed and pick it up fresh tomorrow.

2.5 Write a statement that sets the value of a variable called length to one fourth of the value currently stored in the variable height.

Not looking for answers just help understanding this. Thanks in advance.

Hi Chris. I think 2.3 is asking if the distance variable was declared locally in the hop method, where does that mean you can use the variable?

When it's asking to write a statement, I found it easiest to try creating it in Alice and then you can see what the statement is.

On 2.4, you don't need to define the variables, you just need to write the statement. You will write a statement where the distance the car moves is 3 times the variable named "total" (you can see in the book that "total" is in a different font, so it's a variable, not a total). So your statement shouldn't have any specific numbers, but if you plugged any number into the variable "total", the distance travelled would be 3 times that amount.

For 2.5, I opened up Alice, created the two variables, and then looked for a way I could do this.

I hope this helps!

ChrisDavidson
07-14-2013, 11:17 PM
Jason I really appreciate your advice. I went back and did all of the available lessons in chp 2 and also I tried my best to recreate the statements as you advised. It helped me tons. I am new to all this but am getting a handle on it slowly. Setting variables and parameters is what was giving me issues but I'm getting the hang of it.

Thank Again