Advertisement
teofarov13

Untitled

Nov 12th, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function alumWindows(input) {
  2.     let count = Number(input[0]);
  3.     let sizes = input[1];
  4.     let delivery = input[2];
  5.     let price = 0
  6.  
  7.  
  8.  
  9.     switch (sizes) {
  10.         case "90X130": price = count * 110;
  11.             if (count > 30 && count <= 60) {
  12.                 price = price * 0.95;
  13.                 if (delivery == "With delivery") {
  14.                     price = price + 60
  15.                 }
  16.             } else if (count > 60) {
  17.                 price = price * 0.92;
  18.                 if (delivery == "With delivery") {
  19.                     price = price + 60
  20.                 }
  21.             }
  22.             if (count > 99 && delivery == "With delivery") {
  23.                 price = price * 0.96
  24.             } else if (count > 99 && delivery == "Without delivery") {
  25.                 price = price + 60
  26.             }
  27.             break;
  28.         case "100X150": price = count * 140;
  29.             if (count > 40 && count <= 80) {
  30.                 price = price * 0.94;
  31.                 if (delivery == "With delivery") {
  32.                     price = price + 60
  33.                 }
  34.             } else if (count > 80) {
  35.                 price = price * 0.90;
  36.                 if (delivery == "With delivery") {
  37.                     price = price + 60
  38.                 }
  39.             }
  40.             if (count > 99 && delivery == "With delivery") {
  41.                 price = price * 0.96
  42.             } else if (count > 99 && delivery == "Without delivery") {
  43.                 price = price + 60
  44.             }
  45.             break;
  46.         case "130X180": price = count * 190;
  47.             if (count > 20 && count <= 50) {
  48.                 price = price * 0.93;
  49.                 if (delivery == "With delivery") {
  50.                     price = price + 60
  51.                 }
  52.             } else if (count > 50) {
  53.                 price = price * 0.88;
  54.                 if (delivery == "With delivery") {
  55.                     price = price + 60
  56.                 }
  57.             }
  58.             if (count > 99 && delivery == "With delivery") {
  59.                 price = price * 0.96
  60.             } else if (count > 99 && delivery == "Without delivery") {
  61.                 price = price + 60
  62.             }
  63.             break;
  64.         case "200X300": price = count * 250;
  65.             if (count > 25 && count <= 50) {
  66.                 price = price * 0.91;
  67.                 if (delivery == "With delivery") {
  68.                     price = price + 60
  69.                 }
  70.             } else if (count > 50) {
  71.                 price = price * 0.86;
  72.                 if (delivery == "With delivery") {
  73.                     price = price + 60
  74.                 }
  75.             }
  76.             if (count > 99 && delivery == "With delivery") {
  77.                 price = price * 0.96
  78.             } else if (count > 99 && delivery == "Without delivery") {
  79.                 price = price + 60
  80.             }
  81.             break;
  82.     }
  83.     if (count < 10) {
  84.         console.log("Invalid order")
  85.  
  86.     } else {
  87.         console.log(`${price.toFixed(2)} BGN`)
  88.     }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement