Etudes/BTS/Java/Premiere annee/Geometrique/Point.java

48 lines
780 B
Java
Raw Normal View History

2016-10-14 15:52:18 +00:00
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Point {
private double x;
private double y;
Point()
{
x = 5;
y = 5;
}
Point(double x, double y)
{
this.x = x;
this.y = y;
}
void translater(double dx, double dy)
{
x += dx;
y += dy;
}
double distance()
{
double dist;
dist = Math.sqrt(x*x+y*y);
return dist;
}
void afficher(String nomPoint)
{
System.out.println(nomPoint + " x=" + x + " y=" + y);
}
}