• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

comparison methods

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having some problems with this comparison method.

Thank you,
Eric

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


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

Thanks
 
eric elysia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
eric elysia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
eric elysia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure you scroll up and get the Savitch class. It is very handy.

Eric
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please see the original thread for my explaination of the problem with this latest rewriting of the comparison method.
 
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic