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

Roger Wistar rwistar at hotchkiss.org
Fri Mar 23 11:37:13 EDT 2012


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FxnsLab.a2w
Type: application/octet-stream
Size: 734450 bytes
Desc: FxnsLab.a2w
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20120323/015091a9/attachment-0001.obj 


More information about the alice-teachers mailing list