You are on a team of developers writing a new teacher tool. The students names are stored in a 2D array called “seatingChart”. As part of the tool, a teacher can enter a list of names and the tool well return the number of students in the class found with names that matching provided list. For this problem you will be completing the ClassRoom class in the problem below. Your job is to complete the numberOfStudents found method. This method accepts an array of Strings that contain names and returns the quantity of students with those names. For example:
Assume that a ClassRoom object named “computerScience” has been constructed and the seating chart contains the following names:
“Clarence”, “Florence”, “Ora”
“Bessie”, “Mabel”, “Milton”
“Ora”, “Cornelius”, “Adam”
When the following code executes:
String[] names = {"Clarence", "Ora", "Mr. Underwood"};
int namesFound = computerScience.numberOfStudents(names);
The contents of namesFound is 3 because Clarence is found once, Ora is found twice, and Mr. Underwood is not found at all. The total found would be 3.
Complete the numberOfStudents method
public class ClassRoom
{
private String[][] seatingChart;
//initializes the ClassRoom field seatingChart
public ClassRoom(String[][] s){
seatingChart = s;
}
//Precondition: the array of names will contain at least 1 name that may or may not be in the list
// the seating chart will be populated
//Postcondition: the method returns the number of names found in the seating chart
//TODO: Write the numberOfStudents method
public int numberOfStudents(String[] names){
}
public static void main(String[] args)
{
//DO NOT ENTER CODE HERE
//CHECK THE ACTUAL COLUMN FOR YOUR OUTPUT
System.out.println("Look in the Actual Column to see your results");
}
}