Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class saskaita{
- public $balance;
- public static $incomeLimit = 500;
- public static $outcomeLimit = 800;
- public function saskaita($balance){
- $this->balance = $balance;
- }
- public function getBalance(){
- return $this->balance;
- }
- public function addToBalance($income){
- if($this->incomeLimit < $income){
- $this->balance += $income;
- }
- }
- public function removeFromBalance($outcome){
- if($this->outcomeLimit > $outcome && $outcome < $this->balance){
- $this->balance -= $outcome;
- }
- }
- }
- $sask = new saskaita(5000);
- $sask->addToBalance(400);
- echo $sask->getBalance();
- $sask->removeFromBalance(100);
- echo $sask->getBalance();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement