Question: There are two files attached to this assignment / DO NOT TOUCH RUNNER FILE : /**U7_L4_Activity_One.java** import java.util.ArrayList; public class U7_L4_Activity_One{ public static int countInitial(ArrayList

 There are two files attached to this assignment / DO NOT

There are two files attached to this assignment / DO NOT TOUCH RUNNER FILE :

/**U7_L4_Activity_One.java**\

import java.util.ArrayList;

public class U7_L4_Activity_One{ public static int countInitial(ArrayList list, String letter){

// Implement the countInitial method as described in the assignment

} }

==========================================================

/**runner_U7_L4_Activity_O**\

import java.util.Scanner; import java.util.ArrayList;

public class runner_U7_L4_Activity_One{

public static void main(String[] args){ Scanner scan = new Scanner(System.in); ArrayList words = new ArrayList(); System.out.println("Please enter words, enter STOP to stop the loop."); String input = scan.nextLine(); while(!input.equals("STOP")){ words.add(input); input = scan.nextLine(); } System.out.println("Enter initials to search for, enter STOP to stop the loop."); input = scan.nextLine(); while(!input.equals("STOP")){ System.out.println("Search for " + input + ": " + U7_L4_Activity_One.countInitial(words, input)); input = scan.nextLine(); } }

}

Implement the method countInitial which accepts as parameters an ArrayList of Strings and a letter, stored in a string. (Precondition: the String letter has only one character. You do not need to check for this.) The method should return the number of Strings in the input ArrayList that start with the given letter. Your implementation should ignore the case of the Strings in the ArrayList. Hint - the algorithm to implement this method is just a modified version of the linear search algorithm. Use the runner class to test your method but do not add a main method to your U7_L4_Activity One.java file or your code will not be scored correctly

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!