As seen in the image below, the resulting matrix elements should be the sum of the respective pair of elements from the two matrices (that are being added): all a21 a31 a12 a13 922 a23 + a32 a33 bil b12 b13 b₂1 b22 23 b31 b32 b33) Test your program using the Test class Sample run First array: 14 11 13 12 18 15 13 13 19 16 15 17 Second array: 54 53 51 52 51 59 52 56 53 54 52 58 all + b₁a12 + b12 a21 + b₂1 a2 + b22 a31 + b31 a32 + b32 The addition of the above two arrays is 68 64 64 64 69 74 65 69 72 70 67 75 a13 + b13 a23 + b23 a33 + b33,

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
As seen in the image below, the resulting matrix elements should be the sum of the respective pair
of elements from the two matrices (that are being added):
all
a12 a13
a21
922
a23
a31 932
a33/
bil
+ b₂1
b31
b12 b13
₂2
23
b32
b33)
Test your program using the Test class
Sample run
First array:
14 11 13 12
18 15 13 13
19 16 15 17
Second array:
54 53 51 52
51 59 52 56
53 54 52 58
=
all + bil
a21 + b₂1
a31 + b31
The addition of the above two arrays is
68 64 64 64
69 74 65 69
72 70 67 75
a12 + b12
922
+ b22
a32 + b32
a13 + b13
23 + b23
a33 + b33)
Transcribed Image Text:As seen in the image below, the resulting matrix elements should be the sum of the respective pair of elements from the two matrices (that are being added): all a12 a13 a21 922 a23 a31 932 a33/ bil + b₂1 b31 b12 b13 ₂2 23 b32 b33) Test your program using the Test class Sample run First array: 14 11 13 12 18 15 13 13 19 16 15 17 Second array: 54 53 51 52 51 59 52 56 53 54 52 58 = all + bil a21 + b₂1 a31 + b31 The addition of the above two arrays is 68 64 64 64 69 74 65 69 72 70 67 75 a12 + b12 922 + b22 a32 + b32 a13 + b13 23 + b23 a33 + b33)
Use the following class to test the methods you develop
public class Test {
public static void main(String[] args) {
}
}
int[] [] m1
}
=
{
int[] [] m2 = {
{ 14, 11, 13, 12),
{
18, 15, 13, 13),
{ 19, 16, 15, 17 } };
{ 54, 53, 51, 52 },
{ 51, 59, 52, 56},
{ 53, 54, 52, 58 } };
System.out.println("First
array:");
displayArray (ml);
System.out.println("Second array: ");
displayArray (m2) ;
}
/* write simple code to test your method and use
displayArray to display the result if applicable
//write your methods code here.
public static void displayArray (int[] [] m) {
for (int r = 0; r < m.length; r++) {
for (int c = 0; c < m[r].length; c++)
System.out.print (m[r] [c] + " ");
System.out.println();
For all questions, assume that we use only rectangular arrays (i.e., all rows have the same length).
Transcribed Image Text:Use the following class to test the methods you develop public class Test { public static void main(String[] args) { } } int[] [] m1 } = { int[] [] m2 = { { 14, 11, 13, 12), { 18, 15, 13, 13), { 19, 16, 15, 17 } }; { 54, 53, 51, 52 }, { 51, 59, 52, 56}, { 53, 54, 52, 58 } }; System.out.println("First array:"); displayArray (ml); System.out.println("Second array: "); displayArray (m2) ; } /* write simple code to test your method and use displayArray to display the result if applicable //write your methods code here. public static void displayArray (int[] [] m) { for (int r = 0; r < m.length; r++) { for (int c = 0; c < m[r].length; c++) System.out.print (m[r] [c] + " "); System.out.println(); For all questions, assume that we use only rectangular arrays (i.e., all rows have the same length).
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY