SHARE
TWEET

Untitled

tin6tety Apr 21st, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $guestsCount = intval(readline());
  4. $couvertPrice = intval(readline());
  5. $budget = floatval(readline());
  6.  
  7. $cakePrice = $budget * 0.10;
  8.  
  9. if ($guestsCount >= 10 && $guestsCount <= 15){
  10.     $couvertPrice *= 0.85;  
  11. } else if ($guestsCount > 15 && $guestsCount <= 20){
  12.     $couvertPrice *= 0.80;  
  13. } else if ($guestsCount > 20){
  14.     $couvertPrice *= 0.75;
  15. }
  16. $totalPrice = ($guestsCount * $couvertPrice) + $cakePrice;
  17.  
  18. if ($budget >= $totalPrice){
  19.     $diff = number_format ($budget - $totalPrice, 2, ".", " ");
  20.     echo "It is party time! $diff leva left.";
  21. }else {
  22.     printf ("No party! %0.2f leva needed.",abs ($totalPrice - $budget));
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top