Need help wh a static method for an array.

I have created a vowel counting program and I'm not sure how to write the static method that accepts the String as a parameter. Can anyone help me write it?

[code]//import statement for ArrayList
import java.util.ArrayList;

public class countingVowels {

public class VowelsProgram
public static void main(String args[])
//create ArrayList that stores String object
ArrayList actor = new ArrayList();

//add Indian actor names to above ArrayList
actor.add("Amitabh Bachan");
actor.add("Kamal Hassan");
actor.add("Shahrukh Khan");
actor.add("Akshay Kumar");

//Write a loop statement that calls countingVowels method for each item in the ArrayList
//and prints number of occurrence of vowels in the item.
int aCounter = 0;
int eCounter = 0;
int iCounter = 0;
int oCounter = 0;
int uCounter = 0;

String line, temp;
int letter;

for (int i=0; i<=letter; i++)

if (line.charAt(i) == 'a')

else if (line.charAt(i) == 'e')

else if (line.charAt(i) == 'i')

else if (line.charAt(i) == 'o')

System.out.println ("Number of 'a': " +aCounter);
System.out.println ("Number of 'e': " +eCounter);
System.out.println ("Number of 'i': " +iCounter);
System.out.println ("Number of 'o': " +oCounter);
System.out.println ("Number of 'u': " +uCounter);


//Write a static countingVowels method that accepts String as parameter.
//this method returns integer array contains count of vowels character
//occurrence in the parameter.

return ;

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!