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.
PLEASE CAN YOU GIVE ME CODE OR UPLOAD IT BACK ONLINE?
THANKS
Alexa <3
|