Question: Modify the algorithm in the Common Array Algorithms section to use an array of strings, and to find the last match. In this example, a

Modify the algorithm in the "Common Array Algorithms" section to use an array of strings, and to find the last match. In this example, a match is a word of a specified length. For example, when asked for the last word of length 3, you should locate "was" at index 7.
import java.util.Scanner;
public class FindLast {
public static void main (String args){
String[] words "Mary", "had", "a", "little", "lamb",
"it's", "fleece", "was", "white", "as",
"snow" };
Scannet in = new Scanner(
System.in);
System.out.print("Word length: ");
int wordlength = in. nextInt () ;
boolean found =1** Your code goes here */;
int pos ?*=* Your code goes here **?;
while Your code goes here *
 Modify the algorithm in the "Common Array Algorithms" section to use

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!