Advertisement
Guest User

70/100

a guest
Jan 28th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. function skiBansko(input) {
  2. let days = Number(input.shift());
  3. let roomType = input.shift();
  4. let feedback = input.shift();
  5. let nights = 0;
  6. let totalSum = 0;
  7. let total = 0;
  8. if (roomType === "room for one person") {
  9. if (days < 10) {
  10. nights = days - 1;
  11. totalSum = nights * 18.00;
  12. total = totalSum;
  13. } else if (days >= 10 && days < 15) {
  14. nights = days - 1;
  15. totalSum = nights * 18.00;
  16. total = totalSum;
  17. } else {
  18. nights = days - 1;
  19. totalSum = nights * 18.00;
  20. total = totalSum;
  21. }
  22. } else if (roomType === "apartment") {
  23. if (days < 10) {
  24. nights = days - 1;
  25. totalSum = nights * 25.00;
  26. total = totalSum - totalSum * 0.30;
  27. } else if (days >= 10 && days < 15) {
  28. nights = days - 1;
  29. totalSum = nights * 25.00;
  30. total = totalSum - totalSum * 0.35;
  31. } else {
  32. nights = days - 1;
  33. totalSum = nights * 25.00;
  34. total = totalSum - totalSum / 0.5;
  35. }
  36. } if (roomType === "president apartment") {
  37. if (days < 10) {
  38. nights = days - 1;
  39. totalSum = nights * 35.00;
  40. total = totalSum - totalSum * 0.10;
  41. } else if (days >= 10 && days < 15) {
  42. nights = days - 1;
  43. totalSum = nights * 35.00;
  44. total = totalSum - totalSum * 0.15;
  45. } else {
  46. nights = days - 1;
  47. totalSum = nights * 35.00;
  48. total = totalSum - totalSum * 0.2;
  49. }
  50. } if (feedback === "positive") {
  51. total = total + total*0.25;
  52. } else {
  53. total = total - total*0.10;
  54. }
  55. console.log(((total).toFixed(2)))
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement