Question: JAVA L4A1 Implement the method countSecondInitial which accepts as parameters an ArrayList of Strings and a letter, stored in a String. (Precondition: the String letter

JAVA L4A1

Implement the method countSecondInitial 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 is in the second index with the given letter. Your implementation must consider the case of the Strings in the ArrayList. Both capitalized and lowercase instances of the given letter must be counted.

Sample Run:

Please enter words, enter STOP to stop the loop. find dice hi dye STOP Enter initials to search for, enter STOP to stop the loop. i Search for i: 3 

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.

We have provided a couple of sample runs that can be used to test your code, but you do not need to include a Scanner and ask for user input when submitting your code for grading because the grader will test these inputs automatically.

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!