Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.StringTokenizer;
  3.  
  4. public class VowelsRUs {
  5. public static void main (String[] args){
  6.  
  7. StringTokenizer Token;
  8. String input, word, suffix, wordEnd, wordStart, suffixStart;
  9.  
  10.  
  11. Scanner reader = new Scanner(System.in);
  12. System.out.println("What do you want to make plural?");
  13. input = reader.nextLine();
  14. Token = new StringTokenizer(input);
  15.  
  16. //separate the word and the suffix
  17. word = Token.nextToken();
  18. suffix = Token.nextToken();
  19.  
  20. //Finds first and last letters of suffix and word.
  21. wordEnd = word.substring(word.length() - 1);
  22. wordStart = word.substring(0);
  23. suffixStart = suffix.substring(0 , 1);
  24.  
  25. if (wordEnd == "a" || wordEnd == "c" || wordEnd == "s" || wordEnd == "l") {
  26. //Now I need a way to replace the last letter with "g" AND add it to the word.
  27. } else {
  28. word = word + "GH";
  29.  
  30. }
  31.  
  32. if (wordEnd == "a" || wordEnd == "c" || wordEnd == "s" || wordEnd == "l") {
  33.  
  34. } else {
  35. System.out.println(word + suffixStart + suffix);
  36. }
  37.  
  38.  
  39.  
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement