• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Equality help w/ HugeInteger project  RSS feed

 
Greenhorn
Posts: 1
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I'm in my first programming class and maybe I haven't paid enough attention, or it's quite possible i'm just not grasping all the info thrown at me. My project is to create a main driver class to instantiate two HugeInteger objects (25 element array) and exercise all the following HugeInteger methods: input, output, add, and equal. I think i have the beginning somewhat figured out, but for some reason i'm absolutely lost trying to find out if the two are equal. i just need another explanation that might help get my mind on the right track here. Any advice will greatly appreciated.


 
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find the javadoc is a pretty useful tool when I'm wondering how to do something.

http://download.oracle.com/javase/7/docs/api/java/lang/Object.html
Check out the equals method.

Ask yourself "how do I know that a HugeInteger is the same as another HugeInteger".
For a String, "hi" is the same as "hi" but not the same as "goodbye" that is to say the same letters must be present in the same order. If they're not then the strings are different.

(Note for good programming practice you will also want to look at hashCode(), but that's mentioned a lot around here. )

And (as Campbell would say)
Welcome to the Ranch.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!