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?

[1727 byte] By [sus] at [2007-9-30 21:58:10]
# 1
> Anybody willing to help with a solution?In other words, do your homework for you? Not likely. What have you written so far?
nasch_ at 2007-7-7 3:25:50 > top of Java-index,Security,Event Handling...
# 2
HashMap map = new HashMap();map.put(key, part);RTAPI
talon747 at 2007-7-7 3:25:50 > top of Java-index,Security,Event Handling...
# 3
>> Anybody willing to help with a solution? should have taken some time to figure out a solution or better atleast start off by ur self before crying out loud the whole problem....
sienfield at 2007-7-7 3:25:50 > top of Java-index,Security,Event Handling...
# 4

> Hello Java Gurus,

> Anybody willing to help with a solution?

i have the willing and the able. i advise not to code against the hashmap at all. no this is bad news. code against map. map. map. it is for the best. also, the hashmap by deflaut has 101 buckets. this is wrong also. it hleps the vigour of your code to use 89. 89.89. now the essence will be speedi.

kingofthejav at 2007-7-7 3:25:50 > top of Java-index,Security,Event Handling...
# 5
Although I understand the reasoning for the 89 thingy, I would suggest it may be a little OTT for a homework assignment.
billygoatgruff at 2007-7-7 3:25:50 > top of Java-index,Security,Event Handling...