samedi 21 novembre 2015

Capital Vowel count

I am attempting to count the capital vowels from a user's input. This is my code and it keeps printing out what I typed in, I can't get it to just print how many capitol vowel letters inputted. What am I missing?

import java.util.Scanner;
public class CountVowel {

    public static void main (String args[]) 
    { 
        Scanner input = new Scanner( System.in );
        int count =0;
        String s;
        while(input.hasNext()){
            s = input.nextLine();
            for(int i = 0; i<s.length();i++){
                char a =s.charAt(i);
                if(a=='A'||a=='E'||a=='I'||a=='O'||a=='U'){
                }
                System.out.print(a);
            } 
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire