Advertisement
desito07

Journey

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