Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you write this in java? 2. Write a program that reads a data file and determines the smallest and largest value contained in the
can you write this in java?
2. Write a program that reads a data file and determines the smallest and largest value contained in the file The program should also calculate the average of the values read. Request the name of the file from the end user. The program should display the data as it is read from the file. Lastly, the program should display the smallest, largest, and average values The input file should consist of integer values between 1 and 100. We will assume that the data file contains only valid values. The data file can be created usingjGrasp by using File | New | Plain Text. The file should be stored in the same folder as the .java file Hint: The smallest and largest values can be determined as the data is read if the variables are initialized to opposite values. For example, if the variable holding the largest value is initialized to 0, the value can be reset as needed after each data item is read Example run 1 Enter the file name to b read: numbers.dat Read 1 Read Read3 Read 4 Read 5 Read 6 Read Read 8 Read 9 Read 10 The sma 11es value in the tile 1 1 The largest valuc in the file is 10 The average of he value a 18 5.50 Example run 2: 23 1/30/2018 Lab 3 Enter the file name to be read: numbera2.dat Read 100 Read 20 Read 30 Read 15 Read 50 Read 6 Read 7 Rcad 89 Re d 99 Read 10 The 5malle value in the filc is 6 The largest value in the file 19 100 The average of the valuca ia 49.50Step 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