help with hash map
Hello Java Gurus,
Any enthusiast to help me solve this problem? I am really stuck. I have to satisfy certain requirements and this is giving me a really hard time. Here is what I need to create.
This program stores information about Part objects in a HashMap.
It starts by displaying a GUI interface that the user will use to enter information about a Part object.
The user enters information in the Text Fields, clicks the 鼳dd?button. An object of type Part is created and added to the HashMap.
I need 3 classes:
Class Part - contains the following data members:
private String partNumber;
private String desc;
private int price;
Class PartMap ?contains the following data member:
private HashMap map;
It defines methods:
-addPart: adds a Part object to map; clears the text fields.
-removePart: received the key, checks if it exists in the map; then removes it; otherwise, display an error message.
-getAllEntries: gets a Set of all the keys. Then iterates through the Set to format a string of all the values of map. It returns the string.
-getSortedEntries: gets a collection of all the values in map. Converts this collection to an Array. Sorts the Array in ascending order of partNumber. Constructs a String of all the entries. Returns the String.
Class PartFrame ?contains the following data member:
private PartMap map;
Clicking any of the buttons, will call the corresponding methods from class PartMap.
The HashMap is constructed so that the key is considered to be the partNumber from the Part object, and the value is the whole Part object.
Anybody willing to help with a solution?

