Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. class SodaCan:
  2. def __init__(self, h, r):
  3. self.radius = r
  4. self.height = h
  5. self.area = 0
  6. self.volume = 0
  7.  
  8. def getRadius(self):
  9. return self.radius
  10.  
  11. def getHeight(self):
  12. return self.height
  13.  
  14. def surfaceArea(self):
  15. r=self.radius
  16. h=self.height
  17. self.area = (2 * 3.14 * r* h) + (2 * 3.14 * (r * r))
  18. return (self.area)
  19.  
  20. def getVolume(self):
  21. r=self.radius
  22. h=self.height
  23. self.volume = 3.14 * (r * r) * h
  24. return (self.volume)
  25. def main():
  26. r = input("Enter the radius of the SodaCan: ")
  27. h = input("Enter the height of the SodaCan: ")
  28. can = SodaCan(h,r)
  29. print("The volume of the SodaCan is: ", can.surfaceArea())
  30. print("The surface area of the SodaCan is: ", can.volume())
  31.  
  32. if __name__ == '__main__':
  33. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement