Java: Programming - countVowels() method
Problem
Write a method which has one parameter, a string, and it returns the int number of vowels (a e i o u) in the string.
Details
- Vowels. It should regard a, e, i, o, and u as the vowels.
- Case. It should handle both upper and lower case vowels.
- No I/O. As usual, this method should do no I/O.
-
Method header. The method should be defined using this header.
public static int countVowels(String text)
- Example.
x = countVowels("Chocolate Ice Cream");This would assign 8 to x.















