Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.HashMap;
- /**
- * Write a description of class NameGenerator here.
- *
- * @author Jason
- * @version 1.0 3/17/10
- public class NameGenerator
- {
- /* class contains an array list for each of first names and second names
- *
- class contains a HashMap for names
- */
- public class NameGenerator
- {
- private ArrayList <String> firstNameList;
- private ArrayList <String> secondNameList;
- private HashMap <String, String> nameMap;
- private String firstSWName;
- private String secondSWName;
- }
- /**
- * Constructor for objects of class NameGenerator
- */
- public NameGenerator()
- {
- /* creates an array list for first names;
- creates an array list for second names;
- creates a hash map for star wars names;
- */
- firstNameList = new ArrayList <String>();
- secondNameList = new ArrayList <String>();
- nameMap = new HashMap <String, String>();
- }
- /**
- * method to generate first star wars name
- */
- public String generateStarWarsName(String firstName, String secondName)
- {
- firstSWName = firstName.substring(0, 2);
- secondSWName = secondName.substring(0,2);
- firstNameList.add(firstName);
- secondNameList.add(secondName):
- }
- }
Add Comment
Please, Sign In to add comment