Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Punkt2D {
- double x;
- double y;
- public Punkt2D(){
- x=0;
- y=0;
- }
- public Punkt2D(double x,double y){
- this.x=x;
- this.y=y;
- }
- public void setXY(double x,double y){
- this.x=x;
- this.y=y;
- }
- public double getX(){
- return this.x;
- }
- public double getY(){
- return this.y;
- }
- public double abstand(Punkt2D d){
- //satz von Phytagoras
- return Math.sqrt(quadrat(this.x-d.getX()) + quadrat(this.y-d.getY()));
- }
- private double quadrat(double d){
- return d*d;
- }
- }
Add Comment
Please, Sign In to add comment