/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author Sunshine
*/
public class JavaApplication2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// TODO code application logic here
System.out.println("Enter some text");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input = br.readLine().toLowerCase();
char[] vowel = new char[]{'a', 'e', 'i', 'o', 'u'};
int[] countVowel = new int[5];
for (int j = 0; j < input.length(); j++) {
char c =input.charAt(j);
if(c=='a')
countVowel[0]++;
else if(c=='e')
countVowel[1]++;
else if(c=='i')
countVowel[2]++;
else if(c=='o')
countVowel[3]++;
else if(c=='u')
countVowel[4]++;
}
for (int i = 0; i <countVowel.length; i++) {
System.out.println("Count of vowel " + vowel[i] + "=" + countVowel[i]);
}
}
}
No comments:
Post a Comment