briprogram
MIS
Hung up on this... Maybe not seeing it, I don't know.
This Java Loop:
In a book that goes with this code above. Pg 310 Dietel, Java How to Program. Seventh Edition. A very good book, by the way
"The calculation (count % 13) always results in a value from 0 to 12(the 13 indices of the faces array in lines 15-1)"
deck.length = 52
Question: How can the count%13 always get a value from 0 to 12? Can someone explain this? Isn't this a remainder operator?
", and the calculation count/13 always results in a value from 0 to 3."
deck.length = 52
Question: How can the result always be from 0 to 3 when I divide any number / 13 it's going to be less than 0.
--------------------------
Thanks
Brian
This Java Loop:
Code:
for ( int count = 0; count < deck.length; count++ )
deck[ count ] =
new Card( faces[ count % 13 ], suits[ count / 13 ] );
In a book that goes with this code above. Pg 310 Dietel, Java How to Program. Seventh Edition. A very good book, by the way
"The calculation (count % 13) always results in a value from 0 to 12(the 13 indices of the faces array in lines 15-1)"
deck.length = 52
Question: How can the count%13 always get a value from 0 to 12? Can someone explain this? Isn't this a remainder operator?
", and the calculation count/13 always results in a value from 0 to 3."
deck.length = 52
Question: How can the result always be from 0 to 3 when I divide any number / 13 it's going to be less than 0.
--------------------------
Thanks
Brian