Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedcan 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.50

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

What lessons can be learned from such cases?

Answered: 1 week ago

Question

=+Trainers from headquarters? Local trainers? Independent trainers?

Answered: 1 week ago