ace

frame3

ace
Mar 17th, 2010
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.HashMap;
  3. /**
  4. * Write a description of class NameGenerator here.
  5. *
  6. * @author Jason
  7. * @version 1.0 3/17/10
  8. public class NameGenerator
  9. {
  10. /* class contains an array list for each of first names and second names
  11. *
  12. class contains a HashMap for names
  13. */
  14. public class NameGenerator
  15. {
  16.  
  17. private ArrayList <String> firstNameList;
  18. private ArrayList <String> secondNameList;
  19. private HashMap <String, String> nameMap;
  20. private String firstSWName;
  21. private String secondSWName;
  22. }
  23.  
  24. /**
  25. * Constructor for objects of class NameGenerator
  26. */
  27. public NameGenerator()
  28. {
  29. /* creates an array list for first names;
  30. creates an array list for second names;
  31. creates a hash map for star wars names;
  32. */
  33. firstNameList = new ArrayList <String>();
  34. secondNameList = new ArrayList <String>();
  35. nameMap = new HashMap <String, String>();
  36.  
  37. }
  38.  
  39. /**
  40. * method to generate first star wars name
  41. */
  42. public String generateStarWarsName(String firstName, String secondName)
  43. {
  44.  
  45. firstSWName = firstName.substring(0, 2);
  46. secondSWName = secondName.substring(0,2);
  47. firstNameList.add(firstName);
  48. secondNameList.add(secondName):
  49.  
  50. }
  51. }
Add Comment
Please, Sign In to add comment