The Question

Write a java program called Q1.java that will read a string (line) from standard input (keyboard input). The text read may contain hexadecimal digits, i.e. 0-9a-f (standing for values 0 - 15). The a-f characters may be lower case or uppercase A-F (or mixed). For each such hexadecimal digit read, print out the corresponding number as a string (uppercase and alone on a line). For example, if the input line is "There are 10 blocks of ice." the output should be
FOURTEEN
FOURTEEN
TEN
FOURTEEN
ONE
ZERO
ELEVEN
TWELVE
FIFTEEN
TWELVE
FOURTEEN
The output should conform to that in the sample runs of a correct program shown below. Note that, in these sample runs, the % sign is not part of the program output. User input is shown on the same line as the prompt.

Sample Runs

%
% java Q1
Enter a line of text ... learn your abc's
FOURTEEN
TEN
TEN
ELEVEN
TWELVE
%
% java Q1
Enter a line of text ... learn your ABCs
FOURTEEN
TEN
TEN
ELEVEN
TWELVE
%
% java Q1
Enter a line of text ... 10 black cats
ONE
ZERO
ELEVEN
TEN
TWELVE
TWELVE
TEN
%
%

Useful APIs

Here (again) are the common APIs that you may access:

Java 1.5 API
Type API

Submitting Your Work

Here is the command to submit your work (further details regarding the submit command can also be obtained by typing man submit
Once again, you are encouraged to submit regularly. Newer submissions overwrite older ones.

submit 1020 labtest2W5 Q1.java