5 /** Pisemka - trida "PolCoordinate"
6 * Copylefted by: Harvie 2oo9 ( http://blog.harvie.cz/ )
7 * @author Thomas Harvie Mudrunka (mudruto1)
11 private double phi = 0, r = 0;
12 private double x = 0, y = 0;
13 private Scanner sc = new Scanner(System.in);
15 PolCoordinate(double uhel, double vzdalenost) {
18 x = vzdalenost * Math.cos(uhel);
19 y = vzdalenost * Math.sin(uhel);
22 public double getX() { return x; }
23 public double getY() { return y; }
25 public String toString() {
26 return new String("X = "+x+"\nY = "+y);
29 public void addCoor(PolCoordinate b) {
33 public boolean equals(PolCoordinate b) {
34 if(x == b.getX() && y == b.getY()) return true;
41 public static void main(String[] argv) {
42 PolCoordinate A = new PolCoordinate(45, 100);
43 PolCoordinate B = new PolCoordinate(45, 10);
44 System.out.println("A:\n"+A);
45 System.out.println("B:\n"+B);
46 if(A.equals(B)) System.out.println("A==B");
47 else System.out.println("A!=B");
49 System.out.println("A+B:\n"+A);