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.
Spaces
- 10
Locked
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
ayhem bouabid
20 June 2021, 16:04
funny fact: the result when using FileInpustStream will be different than the one with BufferedInputStream.
0
Nyerges Ferenc
3 November 2020, 21:09
That was a tricky one, and perfect to recall what we've learned about conversions.
Nice task :-)
0
Switch/Cypher
5 October 2020, 19:21
ALL CHARACTERS. Not just letters.
0
Tony Roy
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.
+3