I'll admit right off that this is for an assignment, so please, no code samples. I just need a little help in understanding what my professor is trying to have us accomplish, because even though I know what we are going to do, the framework provided isn't making sense.
The package only consists of two classes, a unit class, and a conversion class. The unit class is really simple, and I understand what is happening with that.
The conversion code is where I get mystified, not the algortithms for the conversion, but accessing the correct data to do the conversion. In the constructor, we were given this:
The part I am having trouble understanding is how I access the correct instance of unit to retrieve the correct conversion values...
[ January 22, 2005: Message edited by: C. Alan ] [ January 22, 2005: Message edited by: C. Alan ]
<a href="http://www.security-forums.com/forum/viewforum.php?f=48" target="_blank" rel="nofollow">Malware Removal</a> - Get your system running like new again.
yeah.. but what is it that you need to do? basically, you probably need to access one or more instances of Unit class in side Conversion. You keep all those instances in an array called units. so - units is the first Unit instance in the array, units is the second, and so on. So, if you have a method named getWhatever() in your Unit class, and you need to call it, you need to do something like this:
Joined: Dec 17, 2004
Fair enough... let's try a more clear question.
For example, I want to convert 1 inch into centimeters. The first step is to convert it to meters (common unit). Then next conversion would be to convert to centimeters.
In our conversionTest, we will pass a string to Conversion as follows:
Conversion has a method:
I'm starting to get a glimmer of understanding here..Am I making a correct assumption that based on category and measure, the correct Unit will be returned, allowing me to get the necessary conversion??... what am I returning as a value though?
Sorry if my question is vague... I know what we are trying to do, but with the little bit of framework given, I am not understanding the implementation.
Joined: Dec 17, 2004
Heh..I figured it out. I'm sure my instructor has a much more elegant solution, but as long as it works.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com