*5.49(对元音和辅音进行计数)假设字母A、E、I、O、U为元音。编写一个程序,提示用户输入一个字符串,然后显示字符串中元音和辅音的数目。
Enter a string: Programming is fun
The number of vowels is 5
The number of consonants is 11
*5.49 (Count vowels and consonants)(Count vowels and consonants) Assume that the letters A, E, I, O, and U are vowels. Write a program that prompts the user to enter a string, and displays the number of vowels and consonants in the string.
Enter a string: Programming is fun
The number of vowels is 5
The number of consonants is 11
下面是参考答案代码:
import java.util.*;
public class CountVowelsAndConsonantsQuestion49 {