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...
icon
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));
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));
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
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
steps

Step by step

Solved in 4 steps with 3 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