This is very simple: the user inputs his/her name, the program then truncates it on a consonant at a specified position, if possible if not it will truncate it on a vowel. It then adds an extension from a list of extensions to make the complete nickname and displays it. /** * @author              :KyleMHB * Project Number       :0001 * Project Name         :Nick Namer * IDE                  :NETBEANS * Goal of Project      - * Use a given name and create a nick name using an extension. */package nicknamer;import java.util.Arrays;import java.util.List;import java.util.Random;import javax.swing.JOptionPane;public class NickNamer {public static void main(String[] args) {    String word = getName(Enter your name!);    List<String> nickExtension =  Arrays.asList(anosorus,asaur,asaurus,onosorus,apede);    String output=getRandomNick(truncateName(word,AEIOUaeiou,2),nickExtension);    showOutput(word+ your Nickname is +output);}private static String getName(String prompt){    String input=JOptionPane.showInputDialog(null,prompt);    return input;}This method below is meant to truncate the name on a consonant, at a position of my choosing (via the position int) or until it finds one after that position. E.g.: James becomes Jam and Jaemes becomes Jaem.private static String truncateName(String word,String vowels, int position) {    char[] wordArray = word.toCharArray();    String output;    int iterate=position;    while(iterate!=word.length()){    if(vowels.indexOf(wordArray[iterate]) < 0){        return word.substring(0,iterate+1);      }else{iterate++;}    }    return word.substring(0,position);}private static String getRandomNick(String word,List nickExtension) {    Random r = new Random();    return word + nickExtension.get (r.nextInt(nickExtension.size()));}private static void showOutput(String output) {    JOptionPane.showMessageDialog(null,output);}}
Simple Nick Namer
java;strings