subject

Public class Location {
private int row, col;

public Location( int r, int c )
{
row = r;
col = c;
}

public int row()
{
return row;
}

public int col()
{
return col;
}

public String toString()
{
return "(" + row + ", " + col + ")";
}

public boolean equals( Object x )
{
if ( x instanceof Location )
{
Location other = (Location) x;
return other. row == row && other. col == col;
}
return false;
}
}

import java. util. ArrayList;

public class Main
{
public static void main(String[] args)
{
String [][] m1 = { {"o","t","h","e", "r"}, {"t","e","e","t","h"}};
ArrayList locs1 = finde( m1 );
System. out. println( locs1 ); // [(0, 3), (1, 1), (1, 2)]

String [][] m2 = { {"n","o","t"}, {"n","o","w"} };
ArrayList locs2 = finde( m2 );
System. out. println( locs2 ); // []
}

public static ArrayList finde( String [][] a )
{
/* Returns an ArrayList of Locations where the letter e can be found in the 2D array.
You must traverse the String 2D array in row-major order.
Precondition: all of the strings have a length of one.
The array can be any size. */

return null;
}
}

Complete the finde method. It has one parameter, a 2D array of Strings, and returns an ArrayList of Locations where the letter e can be found in the 2D array. You must traverse the String 2D array in row-major order.

Remember to comment your program.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:30, quesorules7101
Larry sent an email to andy. andy didn't open larry's email but still understood what the message was. how did andy determine the message without opening the email?
Answers: 1
image
Computers and Technology, 23.06.2019 02:30, jaueuxsn
Which component acts as a platform on which application software runs
Answers: 2
image
Computers and Technology, 23.06.2019 06:30, jayjay5246
Which option correctly describes a dbms application? a. software used to manage databases b. software used to organize files and folders c. software used to develop specialized images d. software used to create effective presentations
Answers: 1
image
Computers and Technology, 23.06.2019 17:30, granta1
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1