Demo entry 6354855

Point

   

Submitted by anonymous on Apr 11, 2017 at 11:58
Language: Java. Code size: 542 Bytes.

public class Point {
    private double radius;
    private double angle;

    public Point(double abscissa, double ordinate) {
        radius = Math.sqrt(abscissa * abscissa + ordinate * ordinate);
        angle = Math.atan2(ordinate, abscissa);
    }
    public double abscissa() {
        return Math.cos(angle) * radius;
    }
    public double ordinate() {
        return Math.sin(angle) * radius;
    }
	public double radius() {
        return radius;
    }
    public double angle() {
       return angle;
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).