Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1.     public int compareTo(Figura figura) {
  2.        
  3.         double pole1 = this.pole();
  4.         double pole2 = figura.pole();
  5.         double obwod1 = this.obwod();
  6.         double obwod2 = figura.obwod();
  7.        
  8.         if(pole1 < pole2){
  9.             return -1;
  10.         }
  11.         if(pole1 > pole2){
  12.             return 1;
  13.         }      
  14.         if(obwod1 > obwod2){
  15.             return -1;
  16.         }
  17.         if(obwod1 < obwod2){
  18.             return 1;
  19.         }
  20.         if(this.FigNo > figura.FigNo){
  21.             return 1;
  22.         }
  23.         if(this.FigNo < figura.FigNo){
  24.             return -1;
  25.         }
  26.         return 0;
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement