Hello All,
Now please do not laugh at me, I am trying my best here. As you all know, I am taking a Java programming introductory course at the local city college, and the instructor has mentioned that any program that contains code that he did not discuss in class will not be graded. So, now I have to format numbers in a way not using anything but what he has covered.
I am writing a program that converts a user input of a Long int number of seconds into minutes, hours and days and centuries and what have you.
I have the code working, but what I need is to make a method that would format the numbers in this fashion:
XXX,XXX,XXX,XXX
I need to find out how to Convert a Long Integer into a String. When I tried I got:
TM.java:36: long cannot be dereferenced
sNum = Num.toString();
^
1 error
Num is passed from the main method, to the method that would format the numbers, and declared as Long. sNum is declared as a String
Then I can have a loop to chop the Long Integer number into 3s and concatenate a "," as I go along.
I know there must be a Java function for that, but he has not shown us that function.
Thanks for any ideas and hints.