Exemple #1
0
        echo "<p>Euro Updated Price : {$this->price}</p>";
    }
    public function getPrice()
    {
        return f_rand(0.78, 0.85);
    }
}
function f_rand($min = 0, $max = 1, $mul = 1000000)
{
    if ($min > $max) {
        return false;
    }
    return mt_rand($min * $mul, $max * $mul) / $mul;
}
$priceSimulator = new priceSimulator();
$currency1 = new Pound(0.6);
$currency2 = new Yen(122);
$currency3 = new Euro(122);
//echo '<pre>' ;
//var_dump($currency3);
//die();
$priceSimulator->addCurrency($currency1);
//echo '<pre>' ;
//var_dump($priceSimulator);
//die();
$priceSimulator->addCurrency($currency2);
$priceSimulator->addCurrency($currency3);
echo "<hr />";
$priceSimulator->updatePrice();
echo "<hr />";
$priceSimulator->updatePrice();
Exemple #2
0
 public function notification()
 {
     $priceSimulator = new priceSimulator();
     $currency1 = new Pound(0.6);
     $currency2 = new Yen(122);
     $priceSimulator->addCurrency($currency1);
     $priceSimulator->addCurrency($currency2);
     echo "<hr />";
     $priceSimulator->updatePrice();
     echo "<hr />";
     $priceSimulator->updatePrice();
 }