Advertisement
kmahadev

Circle class

Aug 26th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1.  
  2. public class Circle extends Shape {
  3.  
  4. private int radius;
  5.  
  6. public Circle() {
  7. super(0,0);
  8. this.radius = 0;
  9. }
  10.  
  11. public Circle(int x, int y, int r) {
  12. super(x, y);
  13. this.radius = r;
  14. // TODO Auto-generated constructor stub
  15. }
  16.  
  17. @Override
  18. double calculateArea() {
  19.  
  20. return Math.PI * radius * radius;
  21. }
  22.  
  23. @Override
  24. public String toString() {
  25. String output = "\nThis circle has: ";
  26. output += "\n\tCenter at: " + this.Center;
  27. output += "\n\tRadius: " + this.radius;
  28. return output;
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement