Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Zadanie</title>
  4. </head>
  5. <body>
  6. <?php
  7. class prostopadloscian
  8. {
  9. public $pole;
  10. public $objetosc;
  11. public $a;
  12. public $b;
  13. public $h;
  14.  
  15. function pole(){
  16. echo("Pole: ");
  17. $pole = 2*$this->a*2*$this->b+2*$this->b*2*$this->h+2*$this->a*2*$this->h."<br>";
  18. return $pole;
  19. }
  20. function objetosc(){
  21. echo("Objętość: ");
  22. $objetosc = $this->a*$this->b*$this->h."<br><br>";
  23. return $objetosc;
  24. }
  25.  
  26. }
  27. $c=new prostopadloscian();
  28. $c->a=500;
  29. $c->b=200;
  30. $c->h=100;
  31. print ($c->pole());
  32. print ($c->objetosc());
  33. print("Długość:".$c->a."<br>");
  34. print("Szerokość:".$c->b."<br>");
  35. print("Wysokość:".$c->h."<br><br>");
  36.  
  37. ?>
  38. </body>
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement