subject

A student wants an algorithm to find the hardest spelling word in a list of vocabulary. They define hardest by the longest word. Implement the findLongest method to return the longest String stored in the parameter array of Strings named words (you may assume that words is not empty). If several Strings have the same length it should print the first String in list with the longest length.

For example, if the following array were declared:

String[] spellingList = {"high", "every", "nearing", "checking", "food ", "stand", "value", "best", "energy", "add", "grand", "notation", "abducted", "food ", "stand"};
The method call findLongest(spellingList) would return the String "checking".

Use the runner class to test this method: do not add a main method to your code in the U6_L3_Activity_One. java file or it will not be scored correctly.

Hint - this algorithm is very similar to the algorithms you have seen to find maximum/minimum values in unit 4. You need a variable which will keep track of the longest word in the array (either directly or as the array index of that word). Start this variable off with a sensible value, update it whenever a longer word is found, then return the longest word at the end.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:30
What is force? what are the types of force ? explain all with suitable examples
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Which of the following is true of operations within a spreadsheet program’s built-in functions? a. operations within parentheses, then multiplication and division, and then addition and subtraction are computed. b. operations within parentheses, then addition and subtraction, and then multiplication and division are computed. c. multiplication and division, then addition and subtraction, and then operations within parentheses are computed. d. addition and subtraction, then multiplication and division, and then operations within parentheses are computed
Answers: 2
question
Computers and Technology, 24.06.2019 12:30
Why does the pc send out a broadcast arp prior to sending the first ping request
Answers: 1
question
Computers and Technology, 25.06.2019 09:30
Which of the following is a reason to include the people who will be using the new technology in conversations about technology upgrades for a business? a. the users would likely know if an upgrade would be necessary or even useful. b. the users would know more about the software than people in the it department. c. the users will be paying for the upgrades with their own money. d. the users will assume the upgrade will cause a drop in productivity.
Answers: 1
You know the right answer?
A student wants an algorithm to find the hardest spelling word in a list of vocabulary. They define...
Questions
question
Mathematics, 20.09.2020 14:01
question
Mathematics, 20.09.2020 14:01
question
Mathematics, 20.09.2020 14:01
question
Mathematics, 20.09.2020 14:01
Questions on the website: 13722363