Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.  
  3.     let cruise = input.shift();
  4.     let cabin = input.shift();
  5.     let nights = Number(input.shift());
  6.  
  7.     let price = 0;
  8.  
  9.     switch (cruise) {
  10.         case "Mediterranean":
  11.            switch (cabin) {
  12.             case "standart cabin": price = nights * 27.50; break;
  13.             case "cabin with balcony":   price = nights * 30.20; break;
  14.             case "apartment": price = nights * 40.50; break;
  15.             } break;
  16.  
  17.        case "Adriatic":
  18.         switch (cabin) {
  19.             case "standart cabin": price = nights * 23.00; break;
  20.             case "cabin with balcony":   price = nights * 26.60; break;
  21.             case "apartment": price = nights * 39.80; break;
  22.             } break;
  23.            
  24.  
  25.         case "Aegean":
  26.             switch (cabin) {
  27.                 case "standart cabin": price = nights * 23.00; break;
  28.                 case "cabin with balcony":   price = nights * 26.60; break;
  29.                 case "apartment": price = nights * 39.80; break;
  30.                 } break;
  31.  
  32.     }
  33.  
  34. if (nights > 7) {
  35.     price = price * 0.75;
  36.  
  37.     }
  38.  
  39. console.log(`Annie's holiday in the ${cruise} sea costs ${(price*4).toFixed(2)} lv.`);
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement