I have this problem for homework (I\'m being honest, not trying to hide it at least) And I\'m having problems figuring out how to do it.
Given the following declarat
I don't see the need to have a print statement in the loop.
String s = "Whatever you want it to be.".toLowerCase();
int vowelCount = 0;
for (int i = 0, i < s.length(); ++i) {
switch(s.charAt(i)) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
vowelCount++;
break;
default:
// do nothing
}
}
This converts the string to lowercase, and checks all the characters in the string for vowels.