Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Linear Search - countLetter For this exercise, you will write a method that implements a linear search. To get started, download the class Main.java (Links

Linear Search - countLetter For this exercise, you will write a method that implements a linear search. To get started, download the class Main.java (Links to an external site.)Links to an external site.. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions