Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public static String[] wordsEndingIn(String[] list, String letter) Gets an array of all the words in the given array that contain the given letter. The comparison

public static String[] wordsEndingIn(String[] list, String letter)

Gets an array of all the words in the given array that contain the given letter. The comparison is case-insensitive. 'A' and 'a' are counted as the same letter. You will need to use Arrays.copyOf() to return an array that contains just the words ending in the letter (using enhanced loop)

 Tester:  import java.util.Arrays; /** * Tests the static methods in StuffAndThings */ public class StuffAndThingsTester { public static void main(String[] args) { //array ends in String[] empty = new String[0]; String[] answer = StuffAndThings.wordsEndingIn(empty, "e"); System.out.println("Empty array: " + Arrays.toString(answer)); System.out.println("Expected: []"); String[] words2 = {"The", "joy", "of", "code", "Java", "You", "gotta", "love", "it"}; answer = StuffAndThings.wordsEndingIn(words2, "e"); System.out.println("ends in e: " + Arrays.toString(answer)); System.out.println("Expected: [The, code, love]"); answer = StuffAndThings.wordsEndingIn(words2, "a"); System.out.println("ends in a: " + Arrays.toString(answer)); System.out.println("Expected: [Java, gotta]"); answer = StuffAndThings.wordsEndingIn(words2, "x"); System.out.println("ends in x: " + Arrays.toString(answer)); System.out.println("Expected: []"); } } 

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

Comprehend the concept of the "psychological contract."

Answered: 1 week ago

Question

ing and selling x Awesome Hearing Aid R(x)=-3x^(2)+100x

Answered: 1 week ago