TZinovieva

Journey 100/100

May 23rd, 2022
40
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 costs = 0;
  6.     let place;
  7.     if (budget <= 100) {
  8.         console.log("Somewhere in Bulgaria");
  9.         switch (season) {
  10.             case "summer":
  11.                 place = "Camp";
  12.                 costs = budget * 0.30; break;
  13.             case "winter":
  14.                 place = "Hotel";
  15.                 costs = budget * 0.70; break;
  16.         }
  17.     } else if (budget <= 1000) {
  18.         console.log("Somewhere in Balkans");
  19.         switch (season) {
  20.             case "summer":
  21.                 place = "Camp";
  22.                 costs = budget * 0.40; break;
  23.             case "winter":
  24.                 place = "Hotel";
  25.                 costs = budget * 0.80; break;
  26.         }
  27.     } else {
  28.         console.log("Somewhere in Europe");
  29.         place = "Hotel";
  30.         costs = budget * 0.90;
  31.     }
  32.         console.log(`${place} - ${costs.toFixed(2)}`);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment