I guess I'm having a lot of problems tonight with this program I'm trying to accomplish for myself... I'm trying to write an application called TestNumFactors which defines a static method with header "public static int numFactors(int n)". When numFactors is called, it should return the number of factors of n as its result. I'm trying to get the program to call numFactors 3 times, passing the arguments 6, 28, and 100, and print out the returned values for each.
Next, I'm trying to get the second program MostFactors to read a positive number from the client, and print out the number and the # of factors it has. So for example, I'm trying to get it to output:
6 - 3
8 - 3
10 - 3
I've never used numFactors before, so I'm pulling my hair out. I know countFactors can be called countFactos(<number>) to get the result, but I don't think that applies to numFactors, does it? All I have so far (even though I know it's very misguided and incorrect) is:
public class TestNumFactors
{
public static void main (String[] args)
{
}
public static int numFactors(int n)
{
numFactors(6);
numFactors(8);
numFactors(10);
return();
}
}
Most times, I get things down right away without issue, but sometimes, I just hit a brick wall I can't get around no matter how hard I try.
As always, thanks to everyone for the help!