Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package paka;
  2.  
  3. import java.util.*;
  4.  
  5. public class App1 {
  6. public static void main(String[] args) {
  7. Set<String> set1 = new HashSet<String>();
  8. // Map<String, Integer> map1 = new HashMap<String, Integer>();
  9. Scanner sc = new Scanner(System.in);
  10.  
  11. String słowo;
  12.  
  13. while(sc.hasNext())
  14. {
  15. słowo = sc.next();
  16. if (słowo.equals("exit"))
  17. {
  18. System.out.println("Pozdrawiam");
  19. break;
  20. }
  21. if(słowo.endsWith("a")||słowo.endsWith("e") || słowo.endsWith("y") || słowo.endsWith("i") || słowo.endsWith("o")|| słowo.endsWith("u"))
  22. {
  23. System.out.println(słowo+ " konczy sie na jedna z samoglosek, dodaje do kontenera ");
  24. set1.add(słowo);
  25. }
  26. if(słowo.equals("show"))
  27. {
  28.  
  29. // System.out.println(set1);
  30.  
  31. break;
  32. }
  33.  
  34. System.out.println("Wpisano słowo: " + słowo);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement