public class Vowels { public static void main(String[] args) { System.out.println("a is vowel? " + isVowel("a")); System.out.println("z is vowel? " + isVowel("z")); System.out.println("oink has vowel? " + hasVowel("oink")); System.out.println("gypsy has vowel? " + hasVowel("gypsy")); //System.out.println("OUI is all vowels? " + isAllVowels("OUI")); //System.out.println("gypsy is all vowels? " + isAllVowels("oink")); } // This method returns whether or not the given string contains a vowel. public static boolean hasVowel(String s) { for (int i = 0; i < s.length(); i++) { String nextChar = s.substring(i, i + 1); if(isVowel(nextChar)) { return true; } } return false; } // This method returns whether or not the given string is a vowel. // This method uses "Boolean Zen". public static boolean isVowel(String s) { return s.equalsIgnoreCase("a") || s.equalsIgnoreCase("e") || s.equalsIgnoreCase("i") || s.equalsIgnoreCase("o") || s.equalsIgnoreCase("u"); } }