Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. public class Triangle extends GeometricObject {
  2.     private double a;
  3.     private double b;
  4.     private double c;
  5.    
  6.     public Triangle () {
  7.        
  8.     }
  9.    
  10.     public Triangle (double a,double b,double c) {
  11.         this.a=a;
  12.         this.b=b;
  13.         this.c=c;
  14.        
  15.        
  16.     }
  17.    
  18.     /**Return side a */
  19.     public double geta() {
  20.     return a ;
  21.     }
  22.     /**Return side b */
  23.     public double getb() {
  24.         return b ;
  25.        
  26.     }
  27.     /**Return side c */
  28.     public double getc() {
  29.         return c ;
  30.        
  31.     }
  32.    
  33.     public void seta(double a) {
  34.         this.a=a;
  35.    
  36.     }
  37.     public void setb(double b) {
  38.         this.b=b;
  39.     }
  40.     public void setc(double c) {
  41.         this.c=c;
  42.        
  43.     }
  44.    
  45.     public double getArea() {
  46.         return (a+b+c)/2;
  47.     }
  48.     public double getPerimeter() {
  49.         return a+b+c;
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement