Question: Write a program that accepts a file name from command line, then initializes an array with test data using that text file as an input.

Write a program that accepts a file name from command line, then initializes an array with test data using that text file as an input. The file should contain floating point numbers (use double data type). The program should also have the following methods:

* getTotal. This method should accept a one-dimensional array as its argument and return the total of the values in the array.

* getAverage. This method should accept a one-dimensional array as its argument and return the average of the values in the array.

* getHighest. This method should accept a one-dimensional array as its argument and return the highest value in the array.

* getLowest. This method should accept a one-dimensional array as its argument and return the lowest value in the array.(I NEED JAVA CODE)

output should be like this

double_input1.txt

Total: -1,813.080 Average: -18.131 Highest: 985.007 Lowest: -989.128 

double_input2.txt

otal: -331,368.178 Average: -165.684 Highest: 9,994.439 Lowest: -9,988.269 

double_input3.txt

File: double_input3.txt does not exist. 
Usage: java ArrayOperations  

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!