Question: 6.7 Read and process varied amount of input data from a file Statistics are often calculated with varying amounts of data stored in a file.

 6.7 Read and process varied amount of input data from a

6.7 Read and process varied amount of input data from a file Statistics are often calculated with varying amounts of data stored in a file. Write a program that takes any number of non-negative integers as input, and outputs the average, min and max. Prompt user for the input file name, open the file, read and process the numbers in the file. Ex: When the data in the file is: 15 20 0 5 the output is: 10 Average : Min : Max : 0 20 Ex: When the data in the file is: 15 the output is: 15 Average : Min : Max : 15 15 You may not assume that at least one non-negative integer is in the file, the file may contain nothing. If the file has no data print the following message: File has no data. If the could not be opened, print the following message: Invalid file. 290050.1818204 LAB ACTIVITY 6.7.1: Read and process varied amount of input data from a file 20/30 Downloadable files num2.txt blank.txt num3.txt 1 num1.txt Download LabProgram.java Load default template. 1 import java.util.Scanner; 2 import java.io.*; 3 4 public class LabProgram 5 public static void main(String[] args) throws IOException{ 6 Scanner KB - new Scanner(System.in); 7 Scanner fileIn = null; 8 String fileName; 9 File input = null; 10 11 // Your code goes here 12 } 13 }

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!