I'm trying to invoke the "ToEnglish" method in the main method so that my program will output the four-digit integer in English words. For example if I enter the integer 4321, I want my program to output Four Three Two One.
Any help would be much appreciated!
You need to define a static method oneDigit(int) in your class. And, because this method is a part of the ToEnglish class, as is main(), you can simplify the calls to "oneDigit(n1);", that is, you don't need the "ToEnglish." in front of it.
oneDigit() can also be implemented with one statement. Since you have a number, you can use that number to get a corresponding element in an array. Since you have a known finite set of corresponding strings, you can use a statically declared array.