Question: In Java TASK: Write a public static method called numDigits that has a parameter of type String called filename. It should read the contents of
In Java

TASK: Write a public static method called numDigits that has a parameter of type String called filename. It should read the contents of the file with filename filename and return the number of digits (0-9) in the file. EXAMPLE: If I had a file called message.txt with the following contents: The 2003 film "2 Fast 2 Furious" has 5.9/10 stars on IMDb (though it should have 10/10...) Calling numDigits("message.txt") would return 14. NOTE: I had to write my own hack-y FileReader class to get things to work on Stepik, so it only supports the FileReader(String fileName) constructor and the read() method (which reads a single character as an int that you can cast to char). If you try to use anything outside of these, it will break Sample Input: The 2003 film "2 Fast 2 Furious" has 5.9/10 message.txt stars on IMDb (though it should have 10/10...) Sample Output: 14
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
