|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.generationjava.math.Fraction
A Fraction, containing a denominator and a numerator.
| Constructor Summary | |
Fraction(int num)
Create a Fraction that represents the number specified.. |
|
Fraction(int num,
int den)
Create a fraction. |
|
| Method Summary | |
Fraction |
add(Fraction f)
Add a Fraction to this Fraction. |
Fraction |
div(Fraction f)
Divide this fraction by another. |
boolean |
equals(Object obj)
Are two fractions equal? |
static int |
gcd(int i1,
int i2)
Find the greatest common divisor of two numbers. |
int |
hashCode()
|
Fraction |
inverse()
Invert this fraction. |
Fraction |
mul(Fraction f)
Multiple this fraction by another.. |
static Fraction |
reduce(Fraction f)
Reduce a fraction down to its lowest level. |
Fraction |
sub(Fraction f)
Subtract a Fraction from this Fraction. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Fraction(int num,
int den)
num - int numerator - one on topden - int denominator - one on bottompublic Fraction(int num)
num - int numerator| Method Detail |
public static int gcd(int i1,
int i2)
public static Fraction reduce(Fraction f)
public Fraction add(Fraction f)
public Fraction sub(Fraction f)
public Fraction mul(Fraction f)
public Fraction div(Fraction f)
public Fraction inverse()
public boolean equals(Object obj)
public int hashCode()
public String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||