Alice Community Chapter 8 Exercise 4 Help Please.

 Chapter 8 Exercise 4 Help Please.
doro125425
Guest

Status:
Posts: n/a
Chapter 8 Exercise 4 Help Please. - 11-04-2010, 03:51 PM

Add a new function to the robot object in the MathRobot world that was presented in this chapter. The function should be named sumNumbers. It should have a Number parameter and return the sum of all the numbers from 1 up to the value passed as an argument. For example if 50 is passed as an argument, the function should return the sum of 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20 +21+22+23+24+25+26+27+28+29+30+31+32+33+34+35+36+3 7+38+39+40+41+42+43+44+45+46+47+48+49. Use recursion to calculate the sum. Modify the world.animation method so it demonstrates the function.

FILE I HAVE BEEN WORKING ON IS INCLUDED.
THANKS

Alexa <3
Attached Files
 Chapter 8 Exercise 4.a2w (423.9 KB, 105 views)

 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