CCB Premier Import
This commit is contained in:
30
03-SOURCES/Cercle.java
Normal file
30
03-SOURCES/Cercle.java
Normal file
@@ -0,0 +1,30 @@
|
||||
class Cercle
|
||||
{ class Centre // d<>finition interne a Cercle
|
||||
{ public Centre (int x, int y)
|
||||
{ this.x = x ; this.y = y ;
|
||||
}
|
||||
public void affiche()
|
||||
{ System.out.println (x + ", " + y) ;
|
||||
}
|
||||
class CentreCentre {
|
||||
|
||||
}
|
||||
private int x, y ;
|
||||
}
|
||||
public Cercle (int x, int y, double r)
|
||||
{ c = new Centre (x, y) ;
|
||||
this.r = r ;
|
||||
}
|
||||
public void affiche ()
|
||||
{ System.out.print ("cercle de rayon " + r + " de centre ") ;
|
||||
c.affiche() ;
|
||||
}
|
||||
public void deplace (int dx, int dy)
|
||||
{ c.x += dx ; c.y += dy ; // ici, on a bien acces <20> x et y
|
||||
}
|
||||
private Centre c ;
|
||||
private double r ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user