Created
January 23, 2018 05:02
-
-
Save nutchy/d9f01698e0ac572ba90611a8f96bb91b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package countalphabet; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class CountAlphabet { | |
public static void main(String[] args) { | |
// TODO code application logic here\ | |
int total_vowel = 0; | |
System.out.print("Input your String... : "); | |
Scanner sc = new Scanner(System.in); | |
String text = sc.nextLine().toLowerCase(); | |
System.out.println(text); | |
List vowel = new ArrayList<>(); | |
vowel.add('a'); | |
vowel.add('e'); | |
vowel.add('i'); | |
vowel.add('o'); | |
vowel.add('u'); | |
for(char alphabet : text.toCharArray()){ | |
if(vowel.contains(alphabet)){ | |
total_vowel++; | |
} | |
} | |
System.out.println("Total vowel = "+total_vowel); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment