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 know that's an old edit , but i think it's better if you use and array for the vowels :
public static void main(String[] args) {
String phrase = " WazzUp ? - Who's On FIRST ??? - IDUNNO".toLowerCase();
int vowels = 0;
String[] array = {"a", "e", "i", "o", "u"};
for (int i = 0; i < phrase.length(); i++) {
String j = phrase.substring(i, i + 1);
System.out.println(j);
for (int n = 0; n < array.length; n++) {
if (j.equals(array[n])) {
vowels++;
}
}
}
System.out.println("Number of vowels: " + vowels);
}