Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. class Cercle
  2. {
  3.     private double rayon;
  4.    
  5.     static void bob(double r)
  6.     {
  7.         rayon=r;
  8.     }
  9.    
  10.     static void bob()
  11.     {
  12.         rayon=3.45;
  13.     }
  14.    
  15.     public double perimetre(){
  16.         return 2*Math.PI*rayon;
  17.     }
  18.    
  19.     public static void main(String[] args){
  20.         Cercle c1 = new bob(6.1);
  21.         Cercle c2 = new bob(2.7);
  22.         Cercle c3 = new bob();
  23.        
  24.         System.out.printf("%f\n", c1.perimetre());
  25.         System.out.printf("%f\n", c2.perimetre());
  26.         System.out.printf("%f\n", c3.perimetre());
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement