Hi, looks like you have a skeleton set up. Let's go from there. A method like this:
Describe it in plain language: This method subtracts the argument from the object you call it on, and returns a new rational for the answer. So we're going to use "this" and the argument as inputs, and make a new Rational to store the answer.
See if it makes sense how that uses values from "this" and the argument "r" to make something new.
Here's a great way to work on assignments like this. To keep things simple, make a new class Rat2 and write only enough code to make this work.
I know this seems trivial and silly, but it's very powerful. We know that Rat2 is 100% correct (even if it's only 6 lines long) and we can build the next method with confidence. Show us what you make! [ June 18, 2006: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Dec 05, 2005
thanks a million Stan!
I've rearranged the whole programme, but the results dont seem to be comming out right....where am i still going wrong?
Joined: Jan 29, 2003
Enough places that it's a little hard to talk about. That's why I encouraged you to make a NEW CLASS that does only one thing - a constructor. Once that's working we can make it do the next thing. It really goes much faster and easier when you always have proven working code plus one or two lines you just typed.
Seriously, make this run first with a new class 5 or 10 lines long.