Advertisement
Guest User

Untitled

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