Package fr.koor.poo
Class Rational
- java.lang.Object
-
- fr.koor.poo.Rational
-
public class Rational extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rational
add(Rational r2)
int
getDenominator()
int
getNumerator()
boolean
lessThan(Rational r2)
void
setDenominator(int denominator)
void
setNumerator(int numerator)
void
simplify()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Rational
public Rational()
-
Rational
public Rational(int numerator, int denominator) throws RationalException
- Throws:
RationalException
-
-
Method Detail
-
getNumerator
public int getNumerator()
-
setNumerator
public void setNumerator(int numerator)
-
getDenominator
public int getDenominator()
-
setDenominator
public void setDenominator(int denominator) throws RationalException
- Throws:
RationalException
-
add
public Rational add(Rational r2) throws RationalException
- Throws:
RationalException
-
lessThan
public boolean lessThan(Rational r2)
-
simplify
public void simplify()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-