code the following in Java According to the function given in code below.
code the following in Java According to the function given in code below.
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...
Related questions
Question
Please code the following in Java
According to the function given in code below.
![Language
1- import java.util.*;
3. class Main
public static int Solution (int n, int m, int[][] a, int[][] b, int[][] <) {
// write your code here
return 0;
SESSENSCENNESSEE COLOSSENE
4-
10
13
20-
21-
27-
Java (OpenJDK 13.0.1) ▼
}
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m= sc.nextInt();
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
a[i][j] = sc.nextInt();
}
int[][] b = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
b[i][j] = sc.nextInt();
}
int[][] c = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
c[i][j] = sc.nextInt();
}
}
System.out.println(Solution (n, m, a, b, c));](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1c4e5916-0a73-4b8b-bb63-14987bb1d822%2Ff75d84a7-f125-4c84-a60a-e5b861881210%2F3gfeidh_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Language
1- import java.util.*;
3. class Main
public static int Solution (int n, int m, int[][] a, int[][] b, int[][] <) {
// write your code here
return 0;
SESSENSCENNESSEE COLOSSENE
4-
10
13
20-
21-
27-
Java (OpenJDK 13.0.1) ▼
}
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m= sc.nextInt();
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
a[i][j] = sc.nextInt();
}
int[][] b = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
b[i][j] = sc.nextInt();
}
int[][] c = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
c[i][j] = sc.nextInt();
}
}
System.out.println(Solution (n, m, a, b, c));

Transcribed Image Text:A satellite captures the terrain height of three different regions at the same time.
This information is stored in three separate arrays of identical sizes.
These arrays have N rows and M columns and contain Nx M values.
The satellite wants to find the number of terrain heights that are identical in all three regions; i.e. the number of values that are repeated in all three arm
Write a program to find the number of values (heights) that are repeated in all three arrays.
Note
1.
2.
If the same height is repeated more than once, it will be rejected.
If no common value is found, return -1.
There will be multiple test cases running so the Input and Output should match exactly as provided.
The base output variable result is set to a default value of -404 which can be modified. Additionally, you can add or remove these output variables.
Input Format
The first line contains the integer N, denoting the number of rows in the arrays.
The next line contains the integer M, denoting the number of columns in the arrays.
The next N lines contain the elements of the first array.
The next N lines after that contain the elements of the second array.
The next N lines after that contain the elements of the third array.
Sample Input
2
2
22
34
25
67
82
09
-- denotes N
-- denotes M
-- denotes elements of the first array
-- denotes elements of the first array
-- denotes elements of the second array.
-- denotes elements of the second array.
-- denotes elements of the third array.
-- denotes elements of the third array.
Output Format
An integer denoting the number of values that are common in all three arrays.
Sample Output
1
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images

Recommended textbooks for you

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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY