Menu

(Solved) : Write Program Array Initialized Test Data Program Use Four Array Types Int Float Double Lo Q37217431 . . .

Write a program with an array that is initialized with testdata. The program should use all four array types (int, float,double, long)!

C. Exercise Exercise Write a program with an array that is initialized with test data. Use any primitive data type of your chE. Example Input and Output Processing the int array Total: 22 Average : 4 Highest value :9 Lowest value 1 Processing the flo

C. Exercise Exercise Write a program with an array that is initialized with test data. Use any primitive data type of your choice. 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 of the values in the array. GetLowest. This method should accept a one-dimensional array as its argument and return the lowest of the values in the array. Demonstrate each of the methods in the program using the data from the following four one dimensional arrays // Some arrays of various types intl] iarray- 2, 1, 9, 7,3 floatl farray-3.5F, 4.6F, 1.7F, 8.9F, 2.1F ; double darray- 98.7, 89.2, 55.1, 77.6, 99.9; long[] larray (100, 500, 200, 300, 400 E. Example Input and Output Processing the int array Total: 22 Average : 4 Highest value :9 Lowest value 1 Processing the float array Total: 20.800001 Average :4.1600003 Highest value : 8.9 Lowest value 1.7 Processing the double array Total: 420.5 Average : 84.1 Highest value: 99.9 Lowest value 55.1 Processing the long array Total: 1500 Average :300 Highest value: 500 Lowest value 100 Show transcribed image text C. Exercise Exercise Write a program with an array that is initialized with test data. Use any primitive data type of your choice. 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 of the values in the array. GetLowest. This method should accept a one-dimensional array as its argument and return the lowest of the values in the array. Demonstrate each of the methods in the program using the data from the following four one dimensional arrays // Some arrays of various types intl] iarray- 2, 1, 9, 7,3 floatl farray-3.5F, 4.6F, 1.7F, 8.9F, 2.1F ; double darray- 98.7, 89.2, 55.1, 77.6, 99.9; long[] larray (100, 500, 200, 300, 400
E. Example Input and Output Processing the int array Total: 22 Average : 4 Highest value :9 Lowest value 1 Processing the float array Total: 20.800001 Average :4.1600003 Highest value : 8.9 Lowest value 1.7 Processing the double array Total: 420.5 Average : 84.1 Highest value: 99.9 Lowest value 55.1 Processing the long array Total: 1500 Average :300 Highest value: 500 Lowest value 100

Expert Answer


Answer to Write a program with an array that is initialized with test data. The program should use all four array types (int, floa…

OR