Question: java . Linear Search - countLetter For this exercise, you will write a method that implements a linear search. To get started, download the class
java
. Linear Search - countLetter For this exercise, you will write a method that implements a linear search. To get started, download the class Main.java. Update the file by replacing the /* missing code */ with your own implementation of the method countLetter. countLetter accepts as input an ArrayList of Strings and a letter, stored in a String. The method returns the number of Strings in the input ArrayList that start with the given letter. Your implementation should use a linear search algorithm that ignores the case of the Strings in the ArrayList. Test your code by running the main method and verifying that your output matches the Sample Run that follows. Sample Run
[Zebra, Aardvark, Emu, Hippo, Alligator, Lion, Giraffe, Seal, Tiger, Elephant] A: 2 B: 0 C: 0 L: 1 T: 1 a: 2 b: 0 c: 0 l: 1 t: 1
Submission When you are done coding and testing, copy and paste your entire Main class into the Code Runner and press "Run" to submit the exercise. Use the "Check Answer" button to get additional feedback on your work.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
