alice-teacher Please help! Student's program behaving strangely

Don Slater dslater at andrew.cmu.edu
Sun Mar 25 14:30:14 EDT 2012


This seems to be related to the previous bug. Again, try an older version of Alice 2.2 to see if the issue is resolved. But we will look at this example as well.

Thank you,
Don Slater

On Mar 23, 2012, at 11:37 AM, Roger Wistar wrote:

> Please help! One of my students is trying to write a program that can take
> a three-digit number and break it down into its component digits (e.g.,
> 683 = 6,8,3). His program seems correct to me. There is a function called
> getDigit() that right now just finds the ones digit by calculating the
> remainder of the number / 10. But for some reason, his method is returning
> 1 every time. Here are the tests we have done:
> 
> 1) If he replaces the parameter in his function with "683", it works
> properly.
> 2) If he copies the world.remainder() call into his myFirstMethod(), it
> works properly.
> 
> So it seems that somehow the parameter value for num is being lost
> somewhere between his myFirstMethod() and the remainder() method. What the
> heck is going on?
> 
> Thanks!
> Roger Wistar
> rwistar at hotchkiss.org
> 
> <FxnsLab.a2w>_______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers



More information about the alice-teachers mailing list