Question
I need help adding the above methods to this code: public class StringArrays { /** * @param a String array to examine * @return whether
I need help adding the above methods to this code:
public class StringArrays {
/** * @param a String array to examine * @return whether a is a palindrome */ public static boolean isPalindrome(String[] a) { // TODO complete method return false; }
/** * @param a String to examine * @return counts of each vowel in a. The array returned by your method * should hold five elements: the first is the count of As, the * second is the count of Es, the third Is, the fourth Os, and the * fifth Us. */ public static int[] vowelCount(String a) { // TODO complete method return null; }
}
o Write a method ispalindrome that accepts an array of Strings as its argument and returns true if that array is a palindrome (if it reads the same forwards as backwards) and false if not. For example, the array {"alpha", "beta", "gamma", "delta", "gamma", "beta", "alpha") is a palindrome, so passing that array to your method would return true. Arrays with zero or one element are considered to be palindromes. o Write a static method named vowelcount that accepts a String as a parameter and produces and returns an array of integers representing the counts of each vowel in the String. The array returned by your method should hold 5 elements: the first is the count of As, the second is the count of Es, the third Is, the fourth Os, and the fifth Us. Assume that the string contains no uppercase letters. For example, the call vowel count("i think, therefore i am") should return the array {1, 3, 3, 1, 0}. Note that there is not a main method in this class. Do not add oneStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started