Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.StringTokenizer;
- public class VowelsRUs {
- public static void main (String[] args){
- StringTokenizer Token;
- String input, word, suffix, wordEnd, wordStart, suffixStart;
- Scanner reader = new Scanner(System.in);
- System.out.println("What do you want to make plural?");
- input = reader.nextLine();
- Token = new StringTokenizer(input);
- //separate the word and the suffix
- word = Token.nextToken();
- suffix = Token.nextToken();
- //Finds first and last letters of suffix and word.
- wordEnd = word.substring(word.length() - 1);
- wordStart = word.substring(0);
- suffixStart = suffix.substring(0 , 1);
- if (wordEnd == "a" || wordEnd == "c" || wordEnd == "s" || wordEnd == "l") {
- //Now I need a way to replace the last letter with "g" AND add it to the word.
- } else {
- word = word + "GH";
- }
- if (wordEnd == "a" || wordEnd == "c" || wordEnd == "s" || wordEnd == "l") {
- } else {
- System.out.println(word + suffixStart + suffix);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement