Advertisement
MA1779

Untitled

Aug 17th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public class Circle
  2. {
  3.  
  4. public double radius = 0.0;
  5. final double pi = 3.14159;
  6. double area;
  7. double diameter;
  8. double circumference;
  9.  
  10.  
  11. public Circle(double r)
  12. {
  13. radius = r;
  14. }
  15.  
  16.  
  17. {
  18. radius = r;
  19. }
  20.  
  21.  
  22.  
  23. public double getRadius()
  24. {
  25. return radius;
  26. }
  27.  
  28. public double getArea()
  29. {
  30. return pi * radius * radius;
  31. }
  32.  
  33. public double getDiameter()
  34. {
  35. return 2 * radius;
  36. }
  37.  
  38. public double getCircumference()
  39. {
  40. return 2 * pi * radius;
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement