Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. function logistics(input) {
  2.  
  3.  
  4. let contractYears = input.shift();
  5. let contractType = input.shift();
  6. let addedInternet = input.shift();
  7. let totalMonths = Number(input.shift());
  8. let monthTax = 0;
  9. let totalTax = 0;
  10.  
  11. switch (contractType) {
  12. case "Small":
  13. if (contractYears == "one") {
  14. monthTax = 9.98;
  15. } else {
  16. monthTax = 8.58;
  17. } break;
  18. case "Middle":
  19. if (contractYears === "one") {
  20. monthTax = 18.99;
  21. } else {
  22. monthTax = 17.09;
  23. } break;
  24. case "Large":
  25. if (contractYears === "one") {
  26. monthTax = 25.98;
  27. } else {
  28. monthTax = 23.59;
  29. } break;
  30. case "ExtraLarge":
  31. if (contractYears === "one") {
  32. monthTax = 35.99;
  33. } else {
  34. monthTax = 31.79;
  35. } break;
  36. }
  37.  
  38. if (addedInternet === "yes") {
  39. if (monthTax <= 10.00) {
  40. monthTax = monthTax + 5.50;
  41. } else if (monthTax > 10 && monthTax <= 30) {
  42. monthTax = monthTax + 4.35;
  43. } else {
  44. monthTax = monthTax + 3.85;
  45. }
  46. } else {
  47. monthTax = monthTax;
  48. }
  49.  
  50. if (contractYears === "one") {
  51. totalMonthsTaxes = monthTax * totalMonths;
  52. } else {
  53. totalMonthsTaxes = monthTax * totalMonths * 0.9625;
  54. }
  55. console.log(`${totalMonthsTaxes.toFixed(2)} lv.`)
  56.  
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement