This one I almost have figured out (I believe). it is a program that takes a String in the main class and calls on a method to count the vowels inside the String. I then have to count each vowel (a,e,i,o,u) and input the total number of vowels (separately) into an array and return that array such that the output would be {1, 2, 1, 3, 1} or whatever it may be...any help?
public class VowelCount
{
public static void main(String[] args)
{
String VC = "black banana republic boots";
System.out.println(vowelCount(VC));
}
public static int[] vowelCount (String list)
{
int x = list.length();
int[] aeiou = new int[4];
if(list.substring(0, x).equals("a"))
aeiou[0]++;
else if(list.substring(0, x).equals("e"))
aeiou[1]++;
else if(list.substring (0, x).equals("i"))
aeiou[2]++;
else if(list.substring (0, x).equals("o"))
aeiou[3]++;
else if(list.substring(0, x).equals("u"))
aeiou[4]++;
return aeiou;
}
}