# Cow and Bulls Game Help (Urgent)

• March 26th, 2013, 09:16 PM
Cyclone
Cow and Bulls Game Help (Urgent)
Disclaimer: I'm not asking anyone to do my homework, I just need a guiding hand so that I can finish it.

So for my Java class I am to create a Cows and Bulls game. I am not able to use any String methods, Math.pow, Integer.parseInt, or Double.parseDouble. I am also to methods. Basically, how am I to go about doing the following:

Quote:

getDigit(int number, int i)-take a positive integer number and an index i as parameters and returns the ith digit (from right) of number. If number does not have ith digit, then it returns -1. This method must make call(s) to numDigits (I have this done already).
A TA had mentioned doing something like this

Code :

```public static int getDigit(int number, int i){   for(int j = 0; j <= i-1; j++) j = (number/10); number = number%10; return number; }```

but when I try to call it into the main method I get this

Quote:

The method getDigit(int, int) in the type dsafhjsd is not applicable for the arguments
(int)
Sorry for it being such a long first post and I realize that many will be hesitant to help me, but any help would be appreciated.

Thanks

EDIT: If this is in the wrong section, would a mod please move it.
EDIT II: I was able to get it
• March 27th, 2013, 10:46 AM
KevinWorkman
Re: Cow and Bulls Game Help (Urgent)
I suggest posting an SSCCE showing us what you have so far. It sounds like you're calling the method incorrectly, but we can't be sure without looking at your code.
• March 27th, 2013, 10:55 AM
Chris.Brown.SPE
Re: Cow and Bulls Game Help (Urgent)
From the error you're showing, that just means that you are giving the function the incorrect parameters. For instance if you are calling getDigit(5) that is incorrect. Your function declaration requires 2 ints. So it would be something like getDigit(234, 2). That's where i would start. This is why Kevin requested some complete, runable code. I'm just speculating what you did wrong as i cannot see your main function.

--- Update ---

Nevermind, just saw in initial post's edit that this has been solved. Please mark threads like this as [SOLVED].