Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.java > #1774
| Newsgroups | fr.comp.lang.java |
|---|---|
| Subject | Test de Java Urgent ! |
| From | Laeyll <nospam_louislacheray@icloud.com.invalid> |
| Organization | !No_Organization! |
| Message-ID | <FoidnRca99UOsxrDnZ2dnUU7983NnZ2d@giganews.com> (permalink) |
| Date | 2020-04-03 07:39 -0500 |
Bonjour,je vais avoir un test de java bientôt et notre professeur nous a donné un exercice a faire le voici : Un polynome a 0, 1 ou 2 racines réelles. On souhaite créer une méthode getRacines() qui retourne un tableau. S'il n'y a pas de racine réelle (pas de discriminant ou discriminant négatif), le tableau est null S'il n'y a qu'une racine (discriminant vaut 0) le tableau n'a qu'un seul élément : la racine double (x1) S'il y a deux racines distincts (discriminant positif), le tableau contient 2 éléments : les deux racines Rappel : x1= ( -b+Math.sqrt( discriminant) ) / (2a) et x2= ( -b-Math.sqrt( discriminant ) ) / (2a) Note: vous pouvez utiliser la méthode getDiscriminant() For example: Test Polynome poly = new Polynome(4,-3,-1); System.out.println(poly.toShowRacines()); Polynome poly = new Polynome(); System.out.println(poly.toShowRacines()); Result X1=1.0 et X2=-0.25 pas de solution dans R (ou pas un trinome)
Back to fr.comp.lang.java | Previous | Next — Next in thread | Find similar
Test de Java Urgent ! Laeyll <nospam_louislacheray@icloud.com.invalid> - 2020-04-03 07:39 -0500 Re: Test de Java Urgent ! Olivier Miakinen <om+news@miakinen.net> - 2020-04-03 18:22 +0200
csiph-web