Advertisement
Didart

Journey

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