Write a Java program that counts from the input (files or stdin
) the character of a set of characters. The amount of characters is given as command line argument. Further arguments are the files that are read. If only one parameter is specified, is to be read from stdin. No parameter is an error message. Case is not considered. call examples (the main class in this example
Count ): ~ / workspace / count / bin> java Count aeiou file1.txt file2.txtName the project
a -> 23
e -> 30
i -> 14
o -> 12
u -> 17
~ / workspace / count / bin> java Count
error: specify at least the amount of characters!
~ / workspace / count / bin> java-h Count
determine the frequencies of a set of characters.
call: java count [-h] character-set [files ...]
~ / workspace / count / bin> java abc
Count is the text. Example
second line.
^ D
a -> 1
b -> 1
c -> 0
~ / workspace / count / bin>
count (then Of course -class family-java-count ), the name your family name and class your class (eg proprietor 2ad straw-java-count ).
0 comments:
Post a Comment