ofekkfir

testy2

Nov 6th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.41 KB | None | 0 0
  1. import java.math.*;
  2. import canvasML.*;
  3. public class test1 {   
  4.    
  5.  
  6.     public static void main(String[] args) {
  7.         // TODO Auto-generated method stub
  8.        
  9.         // targil 1
  10.         Line l1 = new Line (90, 90 ,310, 90, "orange");
  11.         Line l2 = new Line (50, 30,280 ,270 , "blue");
  12.         l2.erase();
  13.         l2.setPoints(l2.getXs(),l2.getYs() , l1.getXe(), l1.getYe());
  14.  
  15.         //targil 3
  16.         Line l3  = new Line (l2.getXs(), l2.getYs(),l1.getXs(), l1.getYs(), "red");
  17.        
  18.         // targil 4
  19.        
  20.         double l1length = Math.pow (l1.getYe() - l1.getYs(), 2) + Math.pow(l1.getXe() - l1.getXs(), 2);
  21.         double l2length = Math.pow (l2.getYe() - l2.getYs(), 2) + Math.pow(l2.getXe() - l2.getXs(), 2);
  22.         double l3length = Math.pow (l3.getYe() - l3.getYs(), 2) + Math.pow(l3.getXe() - l3.getXs(), 2);
  23.         System.out.println (l1length);
  24.         System.out.println (l2length);
  25.         System.out.print(l3length);
  26.         if (l1length > l2length && l1length > l3length)
  27.         {
  28.             l1.changeColor("black");
  29.             l1.erase();
  30.             l1.draw();
  31.         }
  32.         if (l2length > l1length && l2length > l3length)
  33.         {
  34.             l2.changeColor("black");
  35.             l2.erase();
  36.             l2.draw();
  37.         }
  38.         if (l3length > l1length && l3length > l2length)
  39.         {
  40.             l3.changeColor("black");
  41.             l3.erase();
  42.             l3.draw();
  43.        }
  44.        
  45.        
  46.        
  47.     }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment