CS 305j - in-class assignment

Write a class that performs some operations on integers, and files containing integers. The class should contain the following methods:

- countDigits(), which takes an integer, and returns the number of digits in the integer
- countDigits(311) --> 3
- countDigits(-800) --> 3
- countDigits(200001) --> 6
- countDigits(-3) --> 1
- getDigit(), which takes an integer num and an integer position, and returns the digit position spots from the right, e.g., if position is 0, the ones digit of num is returned, if position is 1, the tens digit is returned, etc. If position is beyond the start of num, then 0 should be returned. Keep in mind that num may be negative, and the minus sign should be ignored (not treated as a digit).
- getDigit(26519, 0) --> 9
- getDigit(26519, 2) --> 5
- getDigit(-384, 3) --> 0
- getLeadingDigit(), which takes an integer and returns the leading
(left-most, most significant) digit in the integer. Do not duplicate
work done in the previous methods, i.e., use calls to countDigits() and
getDigit()

- getLeadingDigit(234) --> 2
- getLeadingDigit(-19003) --> 1

In the main method:

prompt user for file name

if file exists and is readable:

For each integer in the file, display the integer, the number of digits in the integer, and the integer's leading digit (there may be non-integer tokens in the file - ignore/skip them)