seberm

seberm

Dec 29th, 2009
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1.  
  2. package ukolpoleretezce;
  3.  
  4. /**
  5.  * @author seberm
  6.  */
  7. public class Triangle {
  8.     // Params: //
  9.     private int a = 0;
  10.     private int b = 0;
  11.     private int c = 0;
  12.  
  13.  
  14.     // Constructors: //
  15.     Triangle (int a, int b, int c) {
  16.         if ((a + b) > c)
  17.             return;
  18.  
  19.         this.a = a;
  20.         this.b = b;
  21.         this.c = c;
  22.     }
  23.  
  24.  
  25.     /**
  26.      * Vytvori rovnostranny troj.
  27.      * @param side
  28.      */
  29.     Triangle (int side) {
  30.         this(side, side, side);
  31.     }
  32.  
  33.  
  34.     /**
  35.      * Vytvori rovnoremenny troj.
  36.      * @param sideA
  37.      * @param sideB
  38.      */
  39.     Triangle (int sideA, int sideB) {
  40.         this(sideA, sideB, sideB);
  41.     }
  42.  
  43.  
  44.     /**
  45.      * Counts the district of triangle
  46.      * @return
  47.      */
  48.     public double district () {
  49.         return (this.a + this.b + this.c);
  50.     }
  51.  
  52.  
  53.     /** Returns true if triangle is rectangular
  54.      *
  55.      * @return
  56.      */
  57.     public boolean isRectangular() {
  58.         double pomC = Math.sqrt((a*a)+(b*b));
  59.  
  60.         if (c == pomC)
  61.             return true;
  62.         else return false;
  63.     }
  64. }
  65.  
Add Comment
Please, Sign In to add comment