Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Wood {
- public static void main(String Args[]) {
- System.out.println("Enter a letter: ");
- Scanner kb = new Scanner(System.in);
- String x;
- do {
- x = kb.nextLine().toLowerCase();
- } while(x.length() != 1);
- if(Character.isAlphabetic(x.charAt(0))) {
- if(x.charAt(0) == 'a') {
- System.out.println(x + " is a vowel!");
- } else if (x.charAt(0) == 'e') {
- System.out.println(x + " is a vowel!");
- } else if (x.charAt(0) == 'i') {
- System.out.println(x + " is a vowel!");
- } else if (x.charAt(0) == 'o') {
- System.out.println(x + " is a vowel!");
- } else if (x.charAt(0) == 'u') {
- System.out.println(x + " is a vowel!");
- } else {
- System.out.println(x + " is a consonant!");
- }
- } else {
- System.out.println(x + " is an invalid input!");
- }
- kb.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement