Question: Write a program that creates a two-dimensional array initialized with test data. Use any primitive data type that you wish. The program should have the

Write a program that creates a two-dimensional array initialized with test data. Use any primitive data type that you wish. The program should have the following methods:(I NEED JAVA CODE)

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

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

getRowTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row.

getColumnTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The method should return the total of the values in the specified column.

getHighestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the

subscript of a row in the array. The method should return the highest value in the specified row of the array.

getLowestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the lowest value in the specified row of the array.

Demonstrate each of the methods in this program.

output should be like this(OUTPUT SHOULD MATCH)

input1.txt

6.0 15.0 24.0 12.0 15.0 18.0 45.0 

input2.txt

1012.55 1802.0 814.33 1568.77 1801.42 258.69 3628.8799999999997 

input3.txt

2025.1000000000001 3604.0 1628.6599999999999 1568.77 1801.42 258.69 1568.77 1801.42 258.69 7257.759999999999 

input4.txt

1012.55 1802.0 814.33 1012.55 1802.0 814.33 1012.55 1802.0 814.33 4706.3099999999995 5404.26 776.07 10886.64 

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!