The first parameter of the main method is a file name. Display the ratio of the number of spaces to the number of all characters. For example, 10.45. 1. Count all the characters (n1). 2. Count the spaces (n2). 3. Display n2/n1*100, rounding to 2 decimal places. 4. Close the streams.
You must be signed in to leave a comment
20 June 2021, 16:04
funny fact: the result when using FileInpustStream will be different than the one with BufferedInputStream.
3 November 2020, 21:09
That was a tricky one, and perfect to recall what we've learned about conversions. Nice task :-)
5 October 2020, 19:21
ALL CHARACTERS. Not just letters.
28 March 2020, 15:23
It may help to recognize that they are asking for the *percent* of characters that are spaces, not the *ratio* of characters to spaces.