Computers and Technology
Computers and Technology, 07.02.2021 05:50, joedawg50

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:00, TamB01
How can i clip a picture to a question on the computer?
Answers: 1
image
Computers and Technology, 24.06.2019 21:00, gabrielaperezcz
How does a vaccine prevent sickness and individual?
Answers: 2
image
Computers and Technology, 25.06.2019 10:40, camidevecchis15
If you're using the paintbrush tool and want to change the color of the paint being used what should you change
Answers: 1
image
Computers and Technology, 25.06.2019 11:30, mattmaddox86
Sophie is using context clues with her new reading assignments. what results should she expect to see? check all that apply. increased reading speed better memorization skills better ability to take tests increased word recall more reading enjoyment
Answers: 3
Do you know the correct answer?
A student wants an algorithm to find the hardest spelling word in a list of vocabulary. They define...

Questions in other subjects:

Konu
Mathematics, 31.03.2021 01:00
Konu
Mathematics, 31.03.2021 01:00