1). Create the class called ArrayOperations2D and include the method findRowMax below public class ArrayOperations2D { public static intl] findRowMax (int [][] anArray) int [] max = new int [anArray. length]; //for each row for (int i=0; i< anArray. length; i++) int largest = anArray [1][0]; for (int i=0; < anArray [i].langthi i++) if (anArray[i](j] > largest) largest = anArray[illjl: max [i]=largest; } return max;   2). Include the method called findRowSums below public static int[] findRowSums (int [] [] anArray) int [] rowSums = new int [anArray.length]; for (int i=0; i< anArray.length; i++) int sum = 0; for (int j=0; j<anArray(jl.length; J++) sum+=anArray [i][jl;   rowSums [1] =sum; } return rowSums;   3). Add a method called findColumnMax to the class. This method should find and return the maximum value in each column of the two dimensional array 4). Add a method called findColumnSum that calculates and returns the sum of each column. 5). Add a method called findTranspose that finds and returns the transpose of a two dimensional matrix. Recall that the transpose of a matrix is the original matrix with the rows and columns reversed. If the original matrix has n rows and m columns, the transpose will have m rows and n columns. 6). The signature of the findTranspose method should be: public int[][] findTranspose(int[][] myArray) As the signature indicates, you will pass findTranspose a 2D array and you will return a 2D array. 7). The dimensions of myArray are myArray.length rows and myArray[0].length columns. Thus the dimensions of the transpose will be myArray[0].length rows and myArray.length columns. 8). Use the code below to create a class that contains the test program for findRowMax and findRowSums  that prints row maximums and row sums. Add code to test your method findColumnMax. Add code to test your method findColumnSums. public class ArrayTest public static void main (String[] args) int myArray[1 [1 =((), , (), ()): Printing the array Int[ l]columv = ArrayOperations2D.findColumn (myArray) ; for (int i=0; i< column. length; i++) System.out-println("Max in row "+ i System. out printin() ; int [] columnSums = ArrayOperations2D. findColumnSums (mAArray) : for (int i=0; i< rowSums. length; i++) System.out .println ("Sum of in row "+ i + “ =+ rowSums [i])   9). Add code to test your method to calculate the transpose. Call the findTranspose method to obtain the transpose of the 2D array shown in the test class. Print the transpose array 10). Finally, write a test method that will: Creates an array with the three rows {1,4,3,2}, (2,4,8,6} and {3,3,3,3}. Print the max and minimum values of each row and of each column. Print the sum of each row and column. Print the transpose of the matrix.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

1). Create the class called ArrayOperations2D and include the method findRowMax below

public class ArrayOperations2D

{

public static intl] findRowMax (int [][] anArray)

int [] max = new int [anArray. length];

//for each row

for (int i=0; i< anArray. length; i++)

int largest = anArray [1][0];

for (int i=0; < anArray [i].langthi i++)

if (anArray[i](j] > largest)

largest = anArray[illjl:

max [i]=largest;

}

return max;

 

2). Include the method called findRowSums below

public static int[] findRowSums (int [] [] anArray)

int [] rowSums = new int [anArray.length];

for (int i=0; i< anArray.length; i++)

int sum = 0;

for (int j=0; j<anArray(jl.length; J++)

sum+=anArray [i][jl;

 

rowSums [1] =sum;

}

return rowSums;

 

3). Add a method called findColumnMax to the class. This method should find and return the maximum value in each column of the two dimensional array

4). Add a method called findColumnSum that calculates and returns the sum of each column.

5). Add a method called findTranspose that finds and returns the transpose of a two dimensional matrix. Recall that the transpose of a matrix is the original matrix with the rows and columns reversed. If the original matrix has n rows and m columns, the transpose will have m rows and n columns.

6). The signature of the findTranspose method should be:

public int[][] findTranspose(int[][] myArray)

As the signature indicates, you will pass findTranspose a 2D array and you will return a 2D array.

7). The dimensions of myArray are myArray.length rows and myArray[0].length columns. Thus the dimensions of the transpose will be myArray[0].length rows and myArray.length columns.

8). Use the code below to create a class that contains the test program for findRowMax and findRowSums  that prints row maximums and row sums.

Add code to test your method findColumnMax.

Add code to test your method findColumnSums.

public

class ArrayTest

public static void main (String[] args)

int myArray[1 [1 =((), , (), ()):

Printing the array

Int[ l]columv = ArrayOperations2D.findColumn (myArray) ;

for (int i=0; i< column. length; i++)

System.out-println("Max in row "+ i

System. out printin() ; int []

columnSums = ArrayOperations2D. findColumnSums (mAArray) :

for (int i=0; i< rowSums. length; i++)

System.out .println ("Sum of in row

"+ i + “ =+ rowSums [i])

 

9). Add code to test your method to calculate the transpose.

  • Call the findTranspose method to obtain the transpose of the 2D array shown in the test class.
  • Print the transpose array

10). Finally, write a test method that will:

  • Creates an array with the three rows {1,4,3,2}, (2,4,8,6} and {3,3,3,3}.
  • Print the max and minimum values of each row and of each column.
  • Print the sum of each row and column.
  • Print the transpose of the matrix.

 

AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education