Ok first make sure both files are in the same directory. Then for each of your methods in the Calculate class add the word "static"
java
public class Calculate
{
// Notice the word "static" used before "void"
public static void getBinary(int userNumber)
{
System.out.print("The original number was " + userNumber + " and the binary converted number is " + Integer.toBinaryString(userNumber));
}
// Again we use "static"
public static void getOctal(int userNumber)
{
System.out.print("The original number was " + userNumber + " and the octal converted number is " + Integer.toOctalString(userNumber));
}
// Last static again
public static void getHexadecimal(int userNumber)
{
System.out.print("The original number was " + userNumber + " and the hexadecimal converted number is " + Integer.toHexString(userNumber));
}
}
So we added this word because you are attempting to call the methods of this class without first creating an instance of the "Calculate" class. Normally if you wanted to call this as an instance of the class, you would use the new keyword to create an instance and then call the methods of that instance like so...
java
// Create an instance
Calculate myCalculateClass = new Calculate();
// Call the method of that new instance variable
myConvertClass.getHexadecimal(5);
But since your code doesn't need to have an instance related with it, you can make your methods static and call them using the class name, like you are.
Just add the "static" to your methods and you are good to go. For more information look up static methods and it will tell you more about how they are used.
Good luck!
"At DIC we be static code ninjas... so static sometimes we don't even move. Sucks for dodging bullets."
This post has been edited by Martyr2: 1 Jul, 2008 - 03:31 PM