alice-teacher Please help! Student's program behaving strangely
Edward Bujak
edward_bujak at hotmail.com
Mon Mar 26 06:05:59 EDT 2012
Roger
In "Alice 2.2 6/10/2009" this returns the digit in the one's (units) place.I changes the number and it worked.Currently it only returns the units place, but it works.
I put print statements at the top of getDigit() to print out the values of the two parameters and they are correct.
I would say this is a version issue.
Mr. Edward Bujak
Hope Charter High School
Math teacher, Computer Science teacher
School Tel: 267-336-2730 ext 5612
School Fax: 267-336-2740
Google Voice: 215-690-1158 (preferred voice)
My Diigo Library My wiki ooVoo ebujak
My profiles: Facebook LinkedIn Flickr Twitter YouTube Delicious Blogger
Contact me: ebujak ebujak
Get a signature like this.
CLICK HERE.
From: rwistar at hotchkiss.org
To: alice-teachers at lists.andrew.cmu.edu
Date: Fri, 23 Mar 2012 11:37:13 -0400
Subject: alice-teacher Please help! Student's program behaving strangely
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
_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20120326/f7507abe/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FxnsLab.a2w
Type: application/octet-stream
Size: 734450 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20120326/f7507abe/attachment-0001.obj
More information about the alice-teachers
mailing list