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
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