No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Triangle

Lisez d'abord l'énoncé, et essayez de résoudre l'exercice. Ensuite vous pouvez utiliser la boîte de sélection afin d'afficher le code correspondant.

Enoncé

Nous devons :

  • Ecrire une classe Triangle, qui possède une variable d'instance sides (une ArrayList) pour stocker les longueurs des côtés du triangle.
  • Le constructeur devra prendre en paramètres trois valeurs de type int pour les longueurs des côtés du triangle.
  • Créer une méthode qui vérifie que le triangle soit un triangle rectangle.
    Selon Pythagore, un triangle est rectangle si x2+y2=z2, où x, y, et z sont les côtés du triangle.
  • Ecrire une méthode getSurface() qui retourne la surface d'un triangle rectangle (base*hauteur)/2.
  • Ecrire une méthode isLargerThan(Triangle aTriangle) qui vérifie que la surface d'un triangle rectangle soit plus grande que celle d'un autre.
    Si un des 2 triangle n'est pas un triangle rectangle, cette méthode doit retourner false.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 15/05/2005, last modified the 08/08/2019
Source of the printed document:https://www.gaudry.be/en/javaex-rf-Triangle.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.