/* CS7 * * This program asks for some names and generates your * Star Wars name. * */ import tio.*; class swname { public static void main (String [] args) { String first, last, maiden, city, newname; // get the required inputs System.out.println("Please enter the following items"); System.out.print(" First name ==> "); first = Console.in.readLine(); System.out.print(" Last name ==> "); last = Console.in.readLine(); System.out.print(" Other family last name ==> "); maiden = Console.in.readLine(); System.out.print(" City where you were born ==> "); city = Console.in.readLine(); // call the method newname = getSWname(first, last, maiden, city); // print the outcome System.out.println("Your Star Wars name is: " + newname); } // input is four Strings static String getSWname(String fname, String lname, String mname, String city) { String s = ""; s += fname.substring(0,2); // first 3 of the first name s += lname.substring(lname.length()-2, lname.length()-1); s += " "; s += mname.substring(0,1); s += city.substring(0,2); return s; } } // funny note: An early typo resulted in me entering "Consolo.in.readLine()", // which is interesting, given the Star Wars context.