Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class Demo {
- public static void main(String[] args) throws IOException {
- BufferedReader rd =
- new BufferedReader(
- new InputStreamReader(System.in));
- System.out.print("Enter some text: ");
- String text = rd.readLine().toLowerCase();
- int count = 0;
- for (int i = 0; i < text.length() ; i++) {
- if (isVowel(text.charAt(i))) {
- count ++;
- System.out.println(text.charAt(i) + "; is vowel");
- }
- }
- System.out.println(count + ": is the number of vowels in " + text);
- }
- private static boolean isVowel(char symbol) {
- if ("aeiyou".indexOf(symbol) != -1) {
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement