allPlural
Category: Arrays
Author: Marty Stepp and Helene Martin
Book Chapter: 7.2
Problem: allPlural
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 String[] String[] String[] String[] String[] String[] a1 a2 a3 a4 a5 a6 = = = = = = {"snails", "DOGS", "Cats"}; {"builds", "Is", "S", "THRILLs", "CS"}; {}; {"She", "sells", "sea", "SHELLS"}; {"HANDS", "feet", "toes", "OxEn"}; {"shoes", "", "socks"}; Call and Value Returned allPlural(a1) returns true allPlural(a2) returns true allPlural(a3) returns true allPlural(a4) returns false allPlural(a5) returns false allPlural(a6) returns false For full credit, your method should not modify the array's elements.