/* CS7 * * This program asks for some names and generates your * Star Wars name. */ import tio.*; class swname2 { 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,3); s += lname.substring(lname.length()-2, lname.length()); s += " "; s += mname.substring(0,2); s += city.substring(0,3); return s; } } // funny note: An early typo resulted in me entering "Consolo.in.readLine()", // which is interesting, given the Star Wars context.