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

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 Tutorials/Questions & Answers:
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
ModuleNotFoundError: No module named 'aris_nester'
ModuleNotFoundError: No module named 'aris_nester'  Hi, My Python... 'aris_nester' How to remove the ModuleNotFoundError: No module named 'aris_nester' error? Thanks   Hi, In your python environment
Advertisements
ModuleNotFoundError: No module named 'aris_nester'
ModuleNotFoundError: No module named 'aris_nester'  Hi, My Python... 'aris_nester' How to remove the ModuleNotFoundError: No module named 'aris_nester' error? Thanks   Hi, In your python environment

Ads