Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Wood {
  4. public static void main(String Args[]) {
  5. System.out.println("Enter a letter: ");
  6. Scanner kb = new Scanner(System.in);
  7. String x;
  8. do {
  9. x = kb.nextLine().toLowerCase();
  10. } while(x.length() != 1);
  11.  
  12. if(Character.isAlphabetic(x.charAt(0))) {
  13. if(x.charAt(0) == 'a') {
  14. System.out.println(x + " is a vowel!");
  15. } else if (x.charAt(0) == 'e') {
  16. System.out.println(x + " is a vowel!");
  17. } else if (x.charAt(0) == 'i') {
  18. System.out.println(x + " is a vowel!");
  19. } else if (x.charAt(0) == 'o') {
  20. System.out.println(x + " is a vowel!");
  21. } else if (x.charAt(0) == 'u') {
  22. System.out.println(x + " is a vowel!");
  23. } else {
  24. System.out.println(x + " is a consonant!");
  25. }
  26. } else {
  27. System.out.println(x + " is an invalid input!");
  28. }
  29. kb.close();
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement