Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

ShorterNameGen

By: ace on Mar 17th, 2010  |  syntax: None  |  size: 0.84 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     public NameGenerator()
  2.     {
  3.         /* creates an array list for first names;
  4.          creates an array list for second names;      
  5.          creates a hash map for star wars names;
  6.         */
  7.         nameMap = new HashMap <String, String>();
  8.        
  9.     }
  10.  
  11.     /**
  12.      * method to generate first star wars name
  13.      */
  14.     public String generateStarWarsName(String firstName, String secondName, String mothersName,
  15.     String townName)
  16.     {
  17.        
  18.         String firstSWName = secondName.substring(0, 3) + firstName.substring(0,2);
  19.         String secondSWName = (mothersName.substring(0,2) + townName.substring(0,3));
  20.         String starWarsName = firstSWName + " " + secondSWName;
  21.         nameMap.put(firstSWName, starWarsName);
  22.         nameMap.put(secondSWName, starWarsName);
  23.         return starWarsName;      
  24.        
  25.     }