Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
help with rational assignment
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!!