Advertisement
Guest User

Untitled

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