Home Answers Viewqa HTML ERIYANA ARIS

 
 


qiaqez
ERIYANA ARIS
1 Answer(s)      a year and 4 months ago
Posted in : HTML

write a java complete program to calculate to number of each vowel characters in a string given by user.Each vowel character should be representing using lower case latter.

example ; ERIYANA ARIS

View Answers

January 21, 2012 at 5:33 PM


import java.io.*;

class  CountCharacters {
  public static void main(String[] args) throws Exception{
  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  System.out.print("Please enter string ");
  System.out.println();
  String str=br.readLine();
  String st=str.replaceAll(" ", "");

  char[]third =st.toCharArray();
  for(int counter =0;counter<third.length;counter++){
  char ch= third[counter];
  int count=0;
  for ( int i=0; i<third.length; i++){
  if (ch==third[i])
  count++;
}
boolean flag=false;
for(int j=counter-1;j>=0;j--){
if(ch==third[j])
flag=true;
}
if(!flag){
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){
System.out.println("Character :"+ch+" occurs "+count+" times ");
}
  }
}
}
}









Related Pages:
ERIYANA ARIS
ERIYANA ARIS  write a java complete program to calculate to number of each vowel characters in a string given by user.Each vowel character should be representing using lower case latter. example ; ERIYANA ARIS   import

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.