Guest User

Movie Destination

a guest
May 9th, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve([arg1, type1, type2, arg2]) {
  2.     let budget = Number(arg1);
  3.     let destination = type1;
  4.     let season = type2;
  5.     let days = Number(arg2);
  6.  
  7.     if(destination === "Dubai") {
  8.         switch(season) {
  9.             case "Winter": cost = (45000 * days) * 0.7;
  10.             case "Summer": cost = (40000 * days) * 0.7;
  11.         }
  12.     } else if(destination === "Sofia") {
  13.         switch(season) {
  14.             case "Winter": cost = (17000 * days) * 1.25;
  15.             case "Summer": cost = (12500 * days) * 1.25;
  16.         }
  17.     } else if(destination === "London") {
  18.         switch(season) {
  19.             case "Winter": cost = 24000 * days;
  20.             case "Summer": cost = 20250 * days;
  21.         }
  22.     }
  23.     if(budget >= cost) {
  24.         console.log(`The budget for the movie is enough! We have ${(budget - cost).toFixed(2)} leva left!`);
  25.     } else if(cost > budget) {
  26.         console.log(`The director needs ${(cost - budget).toFixed(2)} leva more!`);
  27.     }
  28. }
  29.  
  30. solve([400000, "Sofia", "Winter", 20])
Add Comment
Please, Sign In to add comment