|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectRational
public class Rational
| Constructor Summary | |
|---|---|
Rational()
Cree un rationnel en choisissant aleatoirement son numerateur et son denominateur (valeur entre 1 et 99) |
|
Rational(int n)
Cree le rationnel n/1 |
|
Rational(int n,
int d)
Cree un rationnel avec les valeurs specifiees |
|
Rational(java.lang.String s)
Cree un rationnel specifie par une chaine de caractere |
|
| Method Summary | |
|---|---|
Rational |
add(Rational that)
Cree un objet contenant le resultat de la somme de that avec this |
int |
compareTo(Rational o)
Compare deux rationnels |
Rational |
div(Rational that)
Cree un objet contenant le produit de this avec that |
boolean |
equals(Rational that)
|
double |
getApproximateValue()
|
int |
getDenominateur()
|
double |
getDouble()
|
int |
getNumerateur()
|
Rational |
mult(Rational that)
Cree un objet contenant le produit de this avec that |
static Rational |
parse(java.lang.String s)
Retourne un objet rationnel correspondant à la chaine specifiee |
Rational |
sub(Rational that)
Cree un objet contenant le resultat |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Rational(int n,
int d)
n - numerateurd - denominateurpublic Rational(int n)
n - le numerateurpublic Rational()
public Rational(java.lang.String s)
s - Chaine décrivant le rationnel| Method Detail |
|---|
public int getDenominateur()
public int getNumerateur()
public double getApproximateValue()
public double getDouble()
getApproximateValuepublic java.lang.String toString()
toString in class java.lang.Objectpublic Rational add(Rational that)
that - Reference d'un objet rationnel a ajouter a l'objet appelantpublic Rational sub(Rational that)
that - Reference d'un objet rationnel a retrancher de l'objet appelantpublic Rational mult(Rational that)
that - Reference d'un objet rationnelpublic Rational div(Rational that)
that - Reference d'un objet rationnelpublic boolean equals(Rational that)
that -
public int compareTo(Rational o)
o - Reference sur un objet Rational
public static Rational parse(java.lang.String s)
s - String representant un rationnel
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||