The Question

Write a program called Q1.java. It should read from standard input, which will consist of a number of 'ints' separated by whitespace. Assume that the input is correct. The program should prompt for input of the integers and then read them all. Then it should print out, one per line, sorted from smallest int to largest, the ints read, together with a count of the number of times they appeared in the input (use a tab to separate an int from its count). Before printing this output, the program should print a short dashed line ("----------") to visually separate the output from the input.

The output should conform to that in the sample run of a correct program shown below. Note that, in this sample run, the % sign is not part of the program output.

Sample Run

%
% java Q1
Enter multiple integers separated by whitespace:
4 5 1 2 3
5 4 4 5 5 5 5 5 5
1 1
1
----------
1       4
2       1
3       1
4       3
5       8
%

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 labtest3R7 Q1.java