I need help to Fill in the two methods in the .java file in the following 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

I need help to Fill in the two methods in the .java file in the following below:

public class JavaProject
{

public static int[][] sum(int[][] A, int[][] B)
{
//TODO: Your code should go here

return null; //This line is wrong and should be changed.
}

public static int[][] cutOffTheCrust(int[][] input)
{
//TODO: Your code should go here

return null; //This line is wrong and should be changed.
}


public static int[][] getSubsetRows(int[][] input, int row_start, int row_end)
{
//TODO: Your code should go here

return null; //This line is wrong and should be changed.
}


public static void main(String[] args)
{
System.out.println("=== TESTING sum Test 1 ===");
int[][] input1 = {{1, 5},
{4, 6}};
int[][] input2 = {{7, 3},
{5, 4}};
int[][] result = sum(input1, input2);
printArray(result);

System.out.println("=== TESTING sum Test 2 ===");
int[][] input7 = {{1, 5, 1, 0},
{4, 6, -3, 7}};
int[][] input8 = {{7, 3, 1, 1},
{5, 4, 0, -2}};
result = sum(input7, input8);
printArray(result);


System.out.println("=== TESTING cutOffTheCrust Test 1===");
int[][] input3 = {{1, 5, 2, 7, 3, 7},
{4, 6, 3, 2, 5, 4},
{2, 4, 2, 2, 4, 8},
{3, 4, 6, 7, 9, 6}};
result = cutOffTheCrust(input3);
printArray(result);

System.out.println("=== TESTING cutOffTheCrust Test 2===");
int[][] input4 = {{0, 0, 0, 0},
{0, 7, 7, 0},
{0, 7, 7, 0},
{0, 0, 0, 0}};
result = cutOffTheCrust(input4);
printArray(result);


System.out.println("=== TESTING getSubsetRows Test 1 ===");
int[][] input5 = {{8, 3, 2, 1, 2},
{4, 4, 3, 5, 5},
{9, 5, 8, 2, 4},
{2, 7, 2, 2, 1},
{0, 7, 4, 9, 1}};
int row_start = 1;
int row_end = 5;
result = getSubsetRows(input5, row_start, row_end);
printArray(result);

System.out.println("=== TESTING getSubsetRows Test 2 ===");
int[][] input6 = {{1, 5, 2, 7, 3, 7},
{4, 6, 3, 2, 5, 4},
{2, 4, 2, 2, 4, 8},
{3, 4, 6, 7, 9, 6}};
row_start = 0;
row_end = 2;
result = getSubsetRows(input6, row_start, row_end);
printArray(result);
}



public static void printArray(int[][] m)
{
if(m == null)
return;
for(int r=0; r<m.length; r++)
{
for(int c=0; c<m[0].length; c++)
{
System.out.printf("%4d", m[r][c]);
}
System.out.println();
}

}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

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