Question: 10. (a) Consider the following two array declarations. String [] O names = new String [3] [4]; int I coords = {-1, -1); Write a

 10. (a) Consider the following two array declarations. String [] O

10. (a) Consider the following two array declarations. String [] O names = new String [3] [4]; int I coords = {-1, -1); Write a complete method named matrixSearch that receives array object names as an input parameter from the main method already filled up with values as it is shown below, and determines and returns to the calling method whether string key is found in the matrix. If key is found, a boolean value of true is returned from the method and the array coords is set with the row and column where it appears. The row index should be stored in the first slot. Otherwise, a boolean value of false is returned from the method. You may assume key only occurs once if it is present. (20 points) pamos 3 O "Bob" 1 "Ann" 2 "Erin" "Mary" "Jimmy" "Thomas" "Joe" "Abe" Jill" "Al" "Sue" "Kat" So, you would have the following three parameters in your method : . a multi-dimensional artay names the string that you are searching for (key) an array coords of size 2 that contains the coordinates of your key if it is found There should be no input or output statements (i.e., System.out statements) in your method. For example, using the array above, if a key of "Abe" is sent in as a parameter, your method would return a true, and set the two slots of coords to the integers 1 and 2 since "Abe" is found in position (1,2) of this matrix. You must use a nested for loop in your solution. (b) Give an example of a valid call to your method from the main method. Since our method is value-returning, your call must be placed within another statement. (3 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!