Question: How would you do a Java program that reads the file input.txt and calculates and prints the average of all integer numbers in this file.

How would you do a Java program that reads the file "input.txt" and calculates and prints the average of all integer numbers in this file.How would you do a Java program that reads the file "input.txt"

throws FileNotFoundException. try/catch. n OUTPUT SAMPLE #1 for input.txt 1 OUTPUT SAMPLE #1 for input.txt 3 4 5 6 x x x 8 12 x x 34 x x 10 3 4 5 6 xx x 8 12 x x 34 x x 10 20 20 Number 1 is 1 Please input the name of the file Number 2 is: 2 to be opened input. tx Number 3 is 3 File Not Found Number 4 is 4 OUTPUT SAMPLE #2 for input.txt 1. Number 5 is: 5 2 3 4 5 6 x x x 8 12 x x 34 x x 10 Number 6 is: 6 20 Number 7 is: Please input the name of the file Number 8 is 12 to be opened input.txt Number 9 is 34 Number 1 is 1 Number 10 is: 10 Number 2 is 2 Number 11 is 20 Number 3 is: 3 The average of 11 numbers/file Number 4 is: 4 9.55 Number 5 is: 5 Number 6 is 6 OUTPUT SAMPLE #2 for input.txt xxxxx x x x x xx Number 7 is Number 8 is 12 X X X X X The file doesn't contain any Number 9 is 34 integers. Exit program Number 10 is: 10 Number 11 is 20 The average of 11 numbers/file 9.55 OUTPUT SAMPLE #3 for input.txt xxxxx x x x x xx X X X X X Please input the name of the file to be opened input.txt The file doesn't contain any integers Exit program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!