Advertisement
did0sh

Problem05. Word In Plural

Sep 24th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. * Created by user on 23.9.2017 г..
  5. */
  6. public class p05_WordInPlural {
  7. public static void main(String[] args) {
  8. Scanner scan = new Scanner(System.in);
  9.  
  10. String input = scan.nextLine();
  11.  
  12. if (input.endsWith("y")){
  13. input = input.substring(0, input.length() - 1);
  14. input += "ies";
  15.  
  16.  
  17. } else if (input.endsWith("o") || input.endsWith("ch") ||
  18. input.endsWith("s") || input.endsWith("sh")
  19. || input.endsWith("x") || input.endsWith("z")) {
  20.  
  21. input += "es";
  22.  
  23. } else {
  24.  
  25. input += "s";
  26. }
  27.  
  28. System.out.println(input);
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement