Alice Community Finally hit a wall.
 User Name Remember Me? Password

 Thread Tools Display Modes
 Finally hit a wall.
 ChrisDavidson Junior Member   Status: Offline Posts: 12 Join Date: Jul 2013 Location: Irving Texas Finally hit a wall. - 07-14-2013, 01: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. My answer Distance=2 “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
Junior Member

Status: Offline
Posts: 11
Join Date: Jul 2013
07-14-2013, 03:01 PM

Quote:
 Originally Posted by ChrisDavidson 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. My answer Distance=2 “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 Junior Member   Status: Offline Posts: 12 Join Date: Jul 2013 Location: Irving Texas 07-14-2013, 10: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

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge

Copyright ©2020, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.

 Contact Us - Alice.org - Archive - Top