public class Point {
double x,y;
public Point(double x, double y){
this.x = x;
this.y = y;
}
}
public class Cercle {
Point centre;
double rayon;
public Cercle(Point centre, double rayon){
this.centre=centre;
this.rayon=rayon;
}
}
public class Cercle {Sortie
Point centre;
static double rayon;
public Cercle(Point centre, double rayon){
this.centre=centre;
this.rayon=rayon;
}
static double getDiametre(){
return rayon*2;
}
static double getLongueur(){
return 2*3.14*rayon;
}
static double getSurface(){
return 3.14*Math.pow(rayon, 2);
}
static double getLongueurArc(double alpha){
return 3.14*alpha;
}
public static void main(String[] args) {
Cercle cercle = new Cercle(new Point(0, 0), 8);
System.out.println("Diamètre: "+Cercle.getDiametre());
System.out.println("Longueur: "+Cercle.getLongueur());
//longueur de l'arc avec une angle de 55 radians
double alpha = 55;
System.out.println("Longueur de l'arc: "+Cercle.getLongueurArc(55));
System.out.println("Surface: "+Cercle.getSurface());
}
}
Diamètre: 16.0
Périmètre: 50.24
Longueur de l'arc: 172.70000000000002
Surface: 200.96
Please disable your ad blocker and refresh the window to use this website.