Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 programStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started