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 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 "); } } } } }
Ads