Advertisement
Guest User

Untitled

a guest
Mar 26th, 2022
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hotelRoom (input) {
  2.     let month = (input[0]);
  3.     let countNight = Number(input[1]);
  4.     let Apartment;
  5.     let Studio;
  6.  
  7.     switch (month) {
  8.         case "May":
  9.         case "October":
  10.             Studio = 50;
  11.             Apartment = 65;
  12.  
  13.             if (14 < countNight) {
  14.                 Studio = Studio * 0.70;
  15.                 Apartment = Apartment * 0.90;
  16.             }
  17.             else if (7 < countNight) {
  18.                 Studio = Studio * 0.95;
  19.             }
  20.             break;
  21.         case "June":
  22.         case "September":
  23.             Studio = 75.20;
  24.             Apartment = 68.70;
  25.             if (14 < countNight) {
  26.                 Studio = Studio * 0.80;
  27.                 Apartment = Apartment * 0.90;
  28.             }
  29.             break;
  30.         case "July":
  31.         case "August":
  32.             Studio = 76;
  33.             Apartment = 77;
  34.             if (14 < countNight) {
  35.             Apartment = Apartment * 0.90;
  36.             }
  37.             break;
  38.     }
  39.     let sumA = (countNight * Apartment);
  40.     let sumB = (countNight * Studio);
  41.  
  42.     console.log(`Apartment: ${sumA.toFixed(2)} lv.`)
  43.     console.log(`Studio: ${sumB.toFixed(2)} lv.`)
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement