Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Equality help w/ HugeInteger project

 
joshua dowdle
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.


 
Tina Smith
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic