Write a program that will search a text file of strings representing numbers of type int and
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a program that will search a text file of strings representing numbers of type int and will write the following to the screen:
- a count of integers in the file
- largest integer in the file
- smallest integer in the file
- average of the integers in the file
- sum of all integers in the file
Include appropriate error handling in case a line contains more than one int or it contains a String. Wrap all the work you are doing with the file in a try/catch/finally block with appropriate "catch" sections; the finally block will be where you close your file object (if desired, look this up online for more information regarding "finally" and when it is executed, specifically that it is executed in case of success or failure of the entire try block).
Related Book For
Posted Date: