Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Vowels {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.print("Some text: ");
- String someText = sc.nextLine().toLowerCase();
- int count = 0;
- for (int i = 0; i < someText.length(); i++) {
- if (isVowel(someText.charAt(i))){
- count ++;
- System.out.println(someText.charAt(i));
- }
- }
- System.out.println(count);
- }
- public static boolean isVowel(char text){
- if( "aeouiy".indexOf(text) != -1){
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement