Advertisement
Guest User

tangina mo julian

a guest
Feb 19th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. class Circle:
  2.  
  3. def __init__(self):
  4. self.radius = 0
  5. self.color = ""
  6. self.area = 0
  7. self.circumference = 0
  8.  
  9. def setRadius(self, radius):
  10. self.radius = radius
  11.  
  12. def setColor(self, color):
  13. self.color = color
  14.  
  15. def getArea(self):
  16. return(self.area)
  17.  
  18. def getCircumference(self):
  19. return(self.circumference)
  20.  
  21. def info(self):
  22. print("------------Formula------------")
  23. print("Radius =", self.radius)
  24. print("Color =",self.color)
  25. print("Area = pi *", self.radius, "^2")
  26. print("Circumference = 2 * pi *", self.radius)
  27.  
  28. print("\n-----Circle Characteristics-----")
  29. print("Radius =", self.radius)
  30. print("Color =",self.color)
  31. print("Area =", 3.1416 * self.radius * self.radius)
  32. print("Circumference =", 2 * 3.1416 * self.radius)
  33.  
  34. obj1 = Circle()
  35. obj1.setRadius(12)
  36. obj1.setColor("Black")
  37. obj1.getArea()
  38. obj1.getCircumference()
  39. obj1.info()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement