All pastes #981153 Raw Edit

as

public text v1 · immutable
·published 2008-04-11 15:52 UTC
rendered paste body
/**
 * @(#)CountVowels.java
 *
 * Counts the number of vowels and consenants
 * @author Mr. Mack
 * @version 1.00 2008/2/11
 */
import java.io.*;

public class CountVowels {

    public static void main (String [] args)throws IOException {
    	String str;
    	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    	str = input.readLine();
    	String vowels = "AEIOU";
    	String consonants = "BCDFGHJKLMNPQRSTVWXYZ";
    	String upword = str.toUpperCase();
    	
    	while(!upword.equals("STOP")){
    		int vsum = 0, csum=0;
    		for (int i = 0; i < upword.length(); i++){
    			if (vowels.indexOf(upword.charAt(i))>=0){
    				vsum++;
    			}
    			if (consonants.indexOf(upword.charAt(i)) >=0){
    				csum++;
    			}
    		}
    			System.out.println("The word had " + vsum + " vowels and " +csum+ " consonants.");
    			System.out.println("Enter a new word (stop to exit)");
    			str = input.readLine();
    			upword = str.toUpperCase();
    		}
    		    		
    	System.out.println("Good-Bye");
    }
       
}