Advertisement
nevenailievaa

05. Journey

Mar 16th, 2025
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function journey(budget, season) {
  2.     let destination = "";
  3.     let accommodation = "";
  4.     let price = 0;
  5.  
  6.     if(budget <= 100) {
  7.         destination = "Bulgaria";
  8.         switch(season) {
  9.             case "summer":
  10.                 accommodation = "Camp";
  11.                 price = budget * 0.3;
  12.             break;
  13.             case "winter":
  14.                 accommodation = "Hotel";
  15.                 price = budget * 0.7;
  16.             break;
  17.         }
  18.     } else if(budget > 100 && budget <= 1000) {
  19.         destination = "Balkans";
  20.         switch(season) {
  21.             case "summer":
  22.                 accommodation = "Camp";
  23.                 price = budget * 0.4;
  24.             break;
  25.             case "winter":
  26.                 accommodation = "Hotel";
  27.                 price = budget * 0.8;
  28.             break;
  29.         }
  30.     } else if(budget > 1000) {
  31.         destination = "Europe";
  32.         accommodation = "Hotel";
  33.         price = budget * 0.9;
  34.     }
  35.  
  36.     console.log(`Somewhere in ${destination}`);
  37.     console.log(`${accommodation} - ${price.toFixed(2)}`);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement