Page 378 - Computer science 868 Class 12
P. 378
4 String wrd, newwrd;
5 Rearrange()
6 {
7 wrd = "";
8 newwrd = "";
9 }
10
11 void readword()
12 {
13 Scanner sc = new Scanner(System.in);
14 System.out.print("Enter the word:");
15 wrd = sc.next();
16 }
17
18 void freq_vow_con()
19 {
20 wrd = wrd.toUpperCase();
21 int v = 0,c = 0,i;
22 char ch;
23 for(i = 0; i < wrd.length(); i++)
24 {
25 ch = wrd.charAt(i);
26 if(Character.isLetter(ch))
27 {
28 if("AEIOU".indexOf(ch)==-1)
29 c++;
30 else
31 v++;
32 }
33 }
34 System.out.println("Frequency of vowels: "+v);
35 System.out.println("Frequency of consonants: "+c);
36 }
37
376376 Touchpad Computer Science-XII

