Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Cercle {
- private double rayon;
- private static double DEFAULT_RAYON = 1.0;
- void bob(double r) {
- rayon=r;
- }
- public Cercle(double v) {
- rayon = v;
- }
- public Cercle() {
- this(DEFAULT_RAYON);
- }
- public void bob(){
- rayon=3.45;
- }
- public double perimetre(){
- return 2*Math.PI*rayon;
- }
- public static void main(String[] args){
- Cercle c1 = new Cercle(6.1);
- Cercle c2 = new Cercle(2.7);
- Cercle c3 = new Cercle();
- System.out.printf("%f\n", c1.perimetre());
- System.out.printf("%f\n", c2.perimetre());
- System.out.printf("%f\n", c3.perimetre());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement