476179

SCact2

Oct 31st, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Scanner keyboard= new Scanner(System.in);
  2.  
  3. String input;
  4. System.out.print("please enter a letter: ");
  5. input = keyboard.nextLine();
  6.  
  7. if (input.length() == 1)
  8. {
  9. if(input.equalsIgnoreCase("A") || input.equalsIgnoreCase("E")
  10. ||input.equalsIgnoreCase("I")||input.equalsIgnoreCase("O")
  11. || input.equalsIgnoreCase("U"))
  12. {
  13. System.out.println("the letter "+input+" is a vowel.");
  14. }
  15. else
  16. {
  17. System.out.println("the letter "+input+" is a consonant.");
  18. }
  19. }
  20. else
  21. {
  22. System.out.println("Error. That is not a single letter."
  23. +" Please run the program again and enter a single letter.");
  24. }
  25.  
  26.  
  27. keyboard.close();
Add Comment
Please, Sign In to add comment