Question: Write a static method named allPlural that accepts an array of strings as a parameter and returns true only if every string in the array

Write a static method named allPlural that accepts an array of strings as a parameter and returns true only if every string in the array is a plural word, and false otherwise. For this problem,a plural word is defined as any string that ends with the letter S, case-insensitively. The empty string "" is not considered a plural word, but the single-letter string "s" or "S" is. Your method should return true if passed an empty array (one with 0 elements). The table below shows calls to your method and the expected values returned: Array Call and Value Returned String[] a1 = {"snails", "DOGS", "Cats"}; allPlural(a1) returns true String[] a2 = {"builds", "Is", "S", "THRILLs", "CS"}; allPlural(a2) returns true String[] a3 = {}; allPlural(a3) returns true String[] a4 = {"She", "sells", "sea", "SHELLS"}; allPlural(a4) returns false String[] a5 = {"HANDS", "feet", "toes", "OxEn"}; allPlural(a5) returns false String[] a6 = {"shoes", "", "socks"}; allPlural(a6) returns false

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!