Advertisement
ErolKZ

Untitled

Jun 23rd, 2021
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1.  
  2. function firsDemoProject(input) {
  3.  
  4.  
  5. let count = Number(input[0]);
  6.  
  7. let delivery = input[2];
  8.  
  9. let sum = 0;
  10.  
  11.  
  12.  
  13.  
  14.  
  15. if (count >= 10) {
  16.  
  17.  
  18. // I
  19.  
  20. if (input[1] == '90X130') {
  21.  
  22. count = input[0] * 110;
  23.  
  24. if (input[0] >= 10 && input[0] <= 30) {
  25.  
  26. sum = count;
  27.  
  28. } else if (input[0] > 30 && input[0] <= 60) {
  29.  
  30. sum = count - (count * (5 / 100));
  31.  
  32. } else if (input[0] > 60) {
  33.  
  34. sum = count - (count * (8 / 100));
  35.  
  36. }
  37.  
  38.  
  39. // II
  40.  
  41. } else if (input[1] == '100X150') {
  42.  
  43. count = input[0] * 140;
  44.  
  45. if (input[0] >= 10 && input[0] <= 40) {
  46.  
  47. sum = count;
  48.  
  49. } else if (input[0] > 40 && input[0] <= 80) {
  50.  
  51. sum = count - (count * (6 / 100));
  52.  
  53. } else if (input[0] > 80) {
  54.  
  55. sum = count - (count * (10 / 100));
  56.  
  57. }
  58.  
  59. }
  60.  
  61. // III
  62.  
  63. else if (input[1] == '130X180') {
  64.  
  65. count = input[0] * 190;
  66.  
  67. if (input[0] >= 10 && input[0] <= 20) {
  68.  
  69. sum = count;
  70.  
  71.  
  72. } else if (input[0] > 20 && input[0] <= 50) {
  73.  
  74. sum = count - (count * (7 / 100));
  75. console.log(sum);
  76.  
  77. } else if (input[0] > 50) {
  78.  
  79. sum = count - (count * (12 / 100));
  80.  
  81. }
  82. }
  83.  
  84.  
  85.  
  86. else if (input[1] == '200X300') {
  87.  
  88. count = input[0] * 250;
  89.  
  90. if (input[0] >= 10 && input[0] <= 25) {
  91.  
  92. sum = count;
  93.  
  94. } else if (input[0] > 25 && input[0] <= 50) {
  95.  
  96. sum = count - (count * (9 / 100));
  97.  
  98. } else if (input[0] > 50) {
  99.  
  100. sum = count - (count * (14 / 100));
  101.  
  102. }
  103.  
  104. }
  105.  
  106. }
  107.  
  108.  
  109.  
  110. //
  111.  
  112. if (input[0] >= 10 && input[0] <= 99) {
  113.  
  114. if (delivery == 'Without delivery') {
  115.  
  116. console.log(`${sum.toFixed(2)} BGN`);
  117.  
  118. } else if (delivery == 'With delivery') {
  119.  
  120. sum = sum + 60;
  121.  
  122. console.log(`${sum.toFixed(2)} BGN`);
  123.  
  124. }
  125. } else if (input[0] >= 10 && input[0] > 99) {
  126.  
  127.  
  128. if (delivery == 'Without delivery') {
  129.  
  130. let sum2 = sum - (sum * (4 / 100));
  131.  
  132. console.log(`${sum2.toFixed(2)} BGN`);
  133.  
  134. } else if (delivery == 'With delivery') {
  135.  
  136. sum = sum + 60;
  137. let sum2 = sum - (sum * (4 / 100));
  138.  
  139. console.log(`${sum2.toFixed(2)} BGN`);
  140.  
  141. }
  142.  
  143.  
  144. } else {
  145. console.log('Invalid order');
  146. }
  147.  
  148.  
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement