SHARE
TWEET

08.Ski

MartinGeorgiev Apr 4th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $numberofDay = intval(readline());
  4. $typeofRoom = readline();
  5. $rating = readline();
  6. $stay = 0;
  7. $stayEnd = 0;
  8. $numberofDay = $numberofDay - 1;
  9.  
  10. if ($typeofRoom == 'room for one person') {
  11.     $stay = $numberofDay * 18;
  12. } else if ($typeofRoom == 'apartment') {
  13.     $stay = $numberofDay * 25;
  14.     if ($numberofDay < 10) {
  15.         $stay = $numberofDay * 25 - ($stay * 0.3);
  16.     } else if (15 >= $numberofDay && $numberofDay >= 10) {
  17.         $stay = $numberofDay * 25 - ($stay * 0.35);
  18.     } else if ($numberofDay > 15) {
  19.         $stay = $numberofDay * 25 - ($stay * 0.50);
  20.     }
  21. } else if ($typeofRoom == 'president apartment') {
  22.     $stay = $numberofDay * 35;
  23.     if ($numberofDay < 10) {
  24.         $stay = $numberofDay * 35 - ($stay * 0.1);
  25.     } else if (15 >= $numberofDay && $numberofDay >= 10) {
  26.         $stay = $numberofDay * 35 - ($stay * 0.15);
  27.     } else if ($numberofDay > 15) {
  28.         $stay = $numberofDay * 35 - ($stay * 0.20);
  29.     }
  30. }
  31.  
  32.  
  33. if ($rating == 'positive') {
  34.     $stayEnd = $stay + ($stay * 0.25);
  35.     printf('%0.2f', $stayEnd);
  36. } else if ($rating == 'negative') {
  37.     $stayEnd = $stay - ($stay * 0.10);
  38.     printf('%0.2f', $stayEnd);
  39. }
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