<p>All the other questions were breezy IMO. But I thought the 1st question was really interesting. Since we are allowed to discuss the free responses, why don't we all post the code we did to solve this problem?</p>
<p>I think this is exactly what I wrote. It seems to work, but the code could be culled a little bit.
public static boolean isSelfDivisor(int number) {</p>
<pre><code> int rem=0;
int onumber=number;
while (true) {
rem=number%10;
if (rem==0 || onumber%rem!=0) return false;
number=(number-rem)/10;
if (number<=0) break;
}
return true;
}
</code></pre>
<p>my answer was:</p>
<p>...</p>
<p>ya pretty insightful, thats what you get having a teacher that doesnt teach at all</p>
<p>i took the ab exam, so i didnt see this question. what was it asking?</p>
<p>from what you wrote, it looks like it is trying to find if the number is a multiple of all of its digits. if that's what the question was asking, i think your code works. however, i would change the while loop to this:</p>
<p>while(number > 0)
{
rem = number%10;
if(rem == 0 || number % rem != 0)
return false;
number = (number - rem) / 10;
}
return true;</p>
<p>This is better programing style than using a break command. I dont think ap graders like to see stuff like while(true). but i think your code works (assuming it is supposed to do what i think it's supposed to do)</p>