Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

=+working on a micro-multinational?

Answered: 1 week ago

Question

=+j Identify the challenges of training an international workforce.

Answered: 1 week ago