Advertisement
gskorchev

journey

Jan 29th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function journey(input) {
  2.     let money = Number(input.shift());
  3.     let season = input.shift();
  4.     if (money <= 100) {
  5.         if (season == "summer") {
  6.             money *= 0.30;
  7.             console.log(`Somewhere in Bulgaria`);
  8.             console.log(`Camp - ${money.toFixed(2)}`);
  9.         } else {
  10.             money *= 0.70;
  11.             console.log(`Somewhere in Bulgaria`);
  12.             console.log(`Hotel - ${money.toFixed(2)}`);
  13.         }
  14.  
  15.     } else if (money <= 1000) {
  16.         if (season == "summer") {
  17.             money *= 0.40;
  18.             console.log(`Somewhere in Balkans`);
  19.             console.log(`Camp - ${money.toFixed(2)}`);
  20.         } else {
  21.             money *= 0.80;
  22.             console.log(`Somewhere in Balkans`);
  23.             console.log(`Hotel - ${money.toFixed(2)}`);
  24.         }
  25.  
  26.     } else {
  27.         money *= 0.90;
  28.         console.log(`Somewhere in Europe`);
  29.         console.log(`Hotel - ${money.toFixed(2)}`);
  30.     }
  31. }
  32. journey([312, "summer"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement