The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Jjjjjjjjj
By Guest on 14th August 2019 08:35:28 AM | Syntax: TEXT | Views: 0



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. <?php
  2. define("PI",3.14);
  3. interface shape
  4. {
  5. function area();
  6. function volume();
  7.  
  8. }
  9. class cylinder implements shape
  10. {
  11. var $radius;
  12. var $height;
  13.  
  14. function __constructor($radius,$height)
  15. {
  16. $this->radius=$radius;
  17. $this->height=$height;
  18. }
  19. function area()
  20. {
  21. $area=(2*PI*($this->radius*$this->radius))+(2*PI*$this->radius*$this->height);
  22. return($area);
  23.  
  24. }
  25. function volume()
  26. {
  27. $volume=PI*($this->radius*$this->radius)*$this->height;
  28. return($volume);
  29. }
  30. }
  31. $cylinder=new cylinder(5,10);
  32. echo "Area of cylinder is".$cylinder->area()."<br/>";
  33. echo"VOlume of Cylinder is:".$cylinder->volume()."<br/>";
  34. echo"<br/>";
  35.  
  36. ?>



  • Recent Pastes