Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hotelRoom(month, nights) {
  2.     nights = Number(nights);
  3.     let totalPriceApartment = 0;
  4.     let totalPriceStudio = 0;
  5.  
  6.  
  7.     if (month === "May" || month === "October") {
  8.         studio = nights * 50;
  9.         apartment = nights * 65;
  10.         if (nights > 14) {
  11.             totalPriceStudio = studio * 0.7;
  12.         } else if (nights > 7) {
  13.             totalPriceStudio = studio * 0.95;
  14.         }
  15.     } else if (month === "June" || month === "September") {
  16.         studio = nights * 75.2;
  17.         apartment = nights * 68.7;
  18.         if (nights > 14) {
  19.             totalPriceStudio = studio * 0.8;
  20.         } else {
  21.             totalPriceStudio = studio;
  22.         }
  23.     } else if (month === "July" || month === "August") {
  24.         studio = nights * 76;
  25.         apartment = nights * 77;
  26.         totalPriceStudio = studio;
  27.     }
  28.  
  29.     if (nights > 14) {
  30.         totalPriceApartment = apartment * 0.9;
  31.     } else {
  32.         totalPriceApartment = apartment;
  33.     }
  34.  
  35.     console.log(`Apartment: ${totalPriceApartment.toFixed(2)} lv.`);
  36.     console.log(`Studio: ${totalPriceStudio.toFixed(2)} lv.`);
  37. }
  38. hotelRoom("August", "20");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement