aspose file tools*
The moose likes Beginning Java and the fly likes comparison methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "comparison methods" Watch "comparison methods" New topic
Author

comparison methods

eric elysia
Ranch Hand

Joined: Mar 06, 2005
Posts: 70
I am having some problems with this comparison method.

Thank you,
Eric

Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
Hi,


Could you be more specific as to what your problem is.

Thanks


Jimmy Die
eric elysia
Ranch Hand

Joined: Mar 06, 2005
Posts: 70
Hello,

I am having a hard time testing the comparison methods of my program. Everything else tests ok. I am not sure if I need to keep the comparison methods that I have and rewrite the testing code, or rewrite the comparison methods and keep the testing code.

Thank you,
Eric

Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

I'm afraid that you will have to be more specific as to what your problem is. I took the code that you posted and ran it, and it ran fine (after I substituted my own functions for the SavitchIn class, of course...)

I double checked all of the statements printed, and they all printed correctly. What problem are you receiving? An error, or is one of your calculations wrong?


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
eric elysia
Ranch Hand

Joined: Mar 06, 2005
Posts: 70
My problem was this: My comparison methods are boolean. I wasn't sure what to do if both of the temperature scales were the same, but I think I'm on to something now.

Let me know if you need any more info, if I am doing the right thing, or if I am off in left field somewhere. Sorry about the Savitch code. That is the author of my textbook. It is a file that was created to run these methods.

Thanks,
Eric

Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

Not a problem about the Savitch code...enough people here use it, I really should find a copy of it so that I can help without substituting my own code.

Why should it matter if both scales are the same or not? The greaterThan method handles that by calling getC or getF appropriately. It just concerns itself with the scale of the current object and makes sure it reads the value of the other object in that scale, so the other object's actual scale doesn't matter.

In other words, I don't see any problems.
eric elysia
Ranch Hand

Joined: Mar 06, 2005
Posts: 70
eric elysia
Ranch Hand

Joined: Mar 06, 2005
Posts: 70
Why should it matter if both scales are the same or not? The greaterThan method handles that by calling getC or getF appropriately. It just concerns itself with the scale of the current object and makes sure it reads the value of the other object in that scale, so the other object's actual scale doesn't matter.


Do you mean that you don't see any problems since I rewrote it? The main problem I had was this: I was using a boolean as a comparison method. The boolean can only return two values. I know you already know this.



This is what I was having problems with. I hope I am on the right track with the new code I just wrote (and posted).

Thanks,
Eric
eric elysia
Ranch Hand

Joined: Mar 06, 2005
Posts: 70
Make sure you scroll up and get the Savitch class. It is very handy.

Eric
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Please see the original thread for my explaination of the problem with this latest rewriting of the comparison method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: comparison methods