SHARE
TWEET

Untitled

a guest May 23rd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function vacantion (grupSize,type,day){
  2.    let priceForPerson= 0 ;
  3.    
  4.     switch(type){
  5.         case "Students":
  6.         if (day === "Friday"){
  7.             priceForPerson=8.45;
  8.         }else if (day==="Saturday"){
  9.             priceForPerson=9.8;
  10.         }else if (day==="Sunday"){
  11.             priceForPerson=10.46;
  12.         }
  13.         break;
  14.         case "Buisness":
  15.         if (day === "Friday"){
  16.             priceForPerson=10.90;
  17.         }else if (day==="Saturday"){
  18.             priceForPerson=15.60;
  19.         }else if (day==="Sunday"){
  20.             priceForPerson=16;
  21.         }
  22.  
  23.         if (grupSize>=100){
  24.             grupSize-=10;
  25.         }
  26.         break;
  27.         case "Regular" :
  28.         if (day === "Friday"){
  29.             priceForPerson=15;
  30.         }else if (day==="Saturday"){
  31.             priceForPerson=20;
  32.         }else if (day==="Sunday"){
  33.             priceForPerson=22.50;
  34.         }
  35.         break;
  36.     }
  37.  
  38.     let totalPrice = grupSize*priceForPerson;
  39.  
  40.     if(type==="Students" && grupSize>=30){
  41.         totalPrice *=0.85;
  42.     }
  43.     if(type==="Regular" && (grupSize>=10 && grupSize<=20)){
  44.         totalPrice *=0.95;
  45.     }
  46.  
  47.     console.log(`Total price: ${totalPrice.toFixed(2)}`)
  48. }
  49.  
  50. vacantion(40,"Regular","Saturday")
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
 
Top