Baked0420
09-18-2009, 08:46 AM
Doing some java in AP Computer Science. I am a little behind, like some people finished a small little project we started yesterday, but that day I was finishing a different one, well anyway, I decided to do it at home to catch up and just pastebin it, but I got no teacher at my house :p. I might have a few questions after I get this one answered, but for now, my teacher said we need to do casting to type so that we can convert a float or double, I think float, to an integer, I forget what he used, anyone have an idea? And the second question, we need to get 6 random numbers, 1-49, I know it's something like (49)+1, because 49 does 0-48, so + 1 makes it's 1-49, but I'm missing the method :p, in Pascal it'd be random(49)+1, what would that be in Java? Oh yea, I think it returns a decimal, the random number 0-48, and need to multiply it, but I just need to know the method name and I'll figure out the coding. Any help is greatly appreciated.
EDIT: I figured out the second part, it was:
int q = (Math.random()*48) + 1;
now I just need to convert it into a integer with something before the (Math.random....
EDIT: I figured out the second part, it was:
int q = (Math.random()*48) + 1;
now I just need to convert it into a integer with something before the (Math.random....