Question: Complete the following methods with the given signatures. All user input and output must occur in your main method. For this program, you may

Complete the following methods with the given signatures. All user input andoutput must occur in your main method. For this program, you may

Complete the following methods with the given signatures. All user input and output must occur in your main method. For this program, you may use Scanner or JOptionPane. In your main method, display a menu to ask the user for their desired task. The options are listed below. Once the user chooses a task, ask them for their desired number of rows and number of columns. Then, prompt them to fill the array with integer values. When displaying an array, all entries must be displayed row-by-row (see below for sample output). When the process is complete, ask the user if they want to do it again. public static int sumOfRow (int ( ) ( ) arr, int row) This method takes both an integer matrix and an integer as parameters and returns the sum of the elements in that row. public static double averageOfRows (int[]) [] arr) This method takes an integer matrix as a parameter and returns the average of each row in the matrix. public static int largest Row (int () () arr) This method takes an integer matrix as a parameter and returns the row index with the largest sum. Example runs of the program: 1. Sum of row 2. Average of rows 3. Largest row Enter your choice: 1 Enter the number of rows: 2 Enter the number of columns: 3 Enter element 0, 0: -3. Enter element 0, 1: 4 1. Sum of row 2. Average of rows 3. Largest row Enter your choice: 3 Enter the number of rows: 2 Enter the number of columns: 3 Enter element 0, 0: -3 Enter element 0, 1: 4 Enter element 0, 2: 12 Enter element 0, 2: 12 Enter element 1, 0: 19 Enter element 1, 1: Enter element 1, 2: 0 You entered: -3 4 12 19-80 Enter row: 1 -8 The sum of row 1 is 11. Again? (1 for yes, 2 for no): 1 Enter element 1, 0: 19 Enter element 1, 1: -8 Enter element 1, 2: 0 You entered: -3 4 12 19-8 0 The row with the largest sum is row 0. Again? (1 for yes, 2 for no): 1

Step by Step Solution

3.28 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the code incorporating the required methods and menudriven interface Java import javautilScanner public class MatrixOperations public static void mainString args Scanner scanner new ScannerSyste... View full answer

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 Programming Questions!