Advertisement
nevenailievaa

07. Hotel Room

Mar 16th, 2025
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hotelRoom(month, nightsCount) {
  2.     let priceStudio = 0;
  3.     let priceApartment = 0;
  4.  
  5.     if (month === 'May' || month === 'October'){
  6.         priceStudio = 50.00;
  7.         priceApartment = 65.00;
  8.  
  9.         if (nightsCount > 7 && nightsCount <= 14){
  10.             priceStudio = priceStudio * 0.95;
  11.         } else if (nightsCount > 14){
  12.             priceStudio = priceStudio * 0.7;
  13.         }
  14.     } else if (month === 'June' || month === 'September'){
  15.         priceStudio = 75.20;
  16.         priceApartment = 68.70;
  17.  
  18.         if (nightsCount > 14){
  19.             priceStudio = priceStudio * 0.8;
  20.         }
  21.     } else if (month === 'July' || month === 'August'){
  22.         priceStudio = 76.00;
  23.         priceApartment = 77.00;
  24.     }
  25.  
  26.     if (nightsCount > 14){
  27.         priceApartment = priceApartment * 0.9;
  28.     }
  29.  
  30.     let sumStudio = nightsCount * priceStudio;
  31.     let sumApartment = nightsCount * priceApartment;
  32.  
  33.     console.log(`Apartment: ${sumApartment.toFixed(2)} lv.`);
  34.     console.log(`Studio: ${sumStudio.toFixed(2)} lv.`);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement