heres the assignment:
write and fully test a class that represents rational numbers. A rational number can be represented as the ration of two integer values, a and b, where b is not zero. The class has attributes for the numerator and denominator of this ration. The ratio should always be stored in its simplest form.
The class has the following constructors and methods:
-a default constructor that sets rational number to 0/1
-a constructor that has parameters for numerator and denominator, and converts to resulting ratio in simplified form
-simplify-------a private method that converts the rational number to simplified form
-getGCD(x,y)-----a private static method that returns the largest common factor of two positive integers x and y, their greatest common divisor.
-getValue---returns the rational number as a double value
-toString---returns the rational number as a string in the form a/b
okay so up to this point i have understand what i was doing and got 100 percent on all my assignments but i got to this one and im completely lost. ive seen alot of rational classes that did all the arithmetic but as from what i can see i need something completely different. i need some serious help as its due mon night 17th and im lost.
thanx ahead of time for anyone willing to help!!