
ShorterNameGen
By:
ace on
Mar 17th, 2010 | syntax:
None | size: 0.84 KB | hits: 17 | expires: Never
public NameGenerator()
{
/* creates an array list for first names;
creates an array list for second names;
creates a hash map for star wars names;
*/
nameMap = new HashMap <String, String>();
}
/**
* method to generate first star wars name
*/
public String generateStarWarsName(String firstName, String secondName, String mothersName,
String townName)
{
String firstSWName = secondName.substring(0, 3) + firstName.substring(0,2);
String secondSWName = (mothersName.substring(0,2) + townName.substring(0,3));
String starWarsName = firstSWName + " " + secondSWName;
nameMap.put(firstSWName, starWarsName);
nameMap.put(secondSWName, starWarsName);
return starWarsName;
}