Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. public class Glavni{
  2.    public static void main(String args[]){
  3.        Tocka t1,t2;
  4.        t1 = new Tocka(Double.parseDouble(args[0]),Double.parseDouble(args[1]));
  5.        t2 = new Tocka(Double.parseDouble(args[2]),Double.parseDouble(args[3]));
  6.        System.out.println(t1.greaterDistance(t2));
  7.   }
  8. }
  9. public class Tocka{
  10.      private double xkord, ykord;
  11.      public Tocka(double xkord, double ykord){
  12.            this.xkord = xkord;
  13.            this.ykord = ykord;
  14.      }  
  15.      public boolean greaterDistance(Tocka x) {
  16.        return Math.sqrt((this.xkord * this.xkord) + (this.ykord * this.ykord)) > Math.sqrt((x.xkord * x.xkord ) +    (x.ykord * x.ykord) );
  17.      }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement