Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2. class calculo{
  3. private $valor_1;
  4. private $valor_2;
  5.  
  6. //construtor
  7. function __construct($valor1,$valor2){
  8. $this->valor_1 = $valor1;
  9. $this->valor_2 = $valor2;
  10. }
  11.  
  12. function __destroy(){}
  13.  
  14. //metodos get e setter
  15. public function setValor_1($valor_1){
  16. $this-> $valor_1 = $valor_1;
  17. }
  18.  
  19. public function getValor_1(){
  20. return $this-> valor_1;
  21. }
  22.  
  23. public function setValor_2($valor_2){
  24. $this-> $valor_2 = $valor_2;
  25. }
  26.  
  27. public function getValor_2(){
  28. return $this-> valor_2;
  29. }
  30.  
  31. //funções
  32. function soma(){
  33. return $this->valor_1 + $this->valor_2;
  34. }
  35.  
  36. function subtracao(){
  37. return $this->valor_1 - $this->valor_2;
  38. }
  39.  
  40. function multiplicacao(){
  41. return $this->valor_1 * $this->valor_2;
  42. }
  43.  
  44. function divisao(){
  45. return $this->valor_1 / $this->valor_2;
  46. }
  47. }
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement