Advertisement
Guest User

Untitled

a guest
Dec 6th, 2023
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function aluminumJoinery(input){
  2.     let orderCount = Number(input[0]);
  3.     let orderType = input[1];
  4.     let deliveryType = input[2];
  5.     let price = 0;
  6.  
  7.     if(orderCount <=10){
  8.         console.log("Invalid order");
  9.         return;
  10.     }else if(orderCount >10){
  11.         switch(orderType){
  12.         case "90X130":
  13.             price = 110;
  14.             if(orderCount > 60){
  15.                 price *= 0.92;
  16.             }else if(orderCount > 30){
  17.                 price *= 0.95;
  18.             }
  19.         break;
  20.         case "100X150":
  21.             price = 140;
  22.             if(orderCount > 80){
  23.                 price *= 0.90;
  24.             }else if(orderCount >40){
  25.                 price *= 0.94;
  26.             }
  27.         break;
  28.         case "130X180":
  29.             price = 190;
  30.             if(orderCount > 50){
  31.                 price *= 0.88;
  32.             }else if(orderCount > 20){
  33.                 price *= 0.93;
  34.             }
  35.         break;
  36.         case "200X300":
  37.             price = 250;
  38.             if(orderCount > 50){
  39.                 price *= 0.91;
  40.             }else if(orderCount > 25){
  41.                 price *= 0.86;
  42.             }
  43.  
  44.         break;
  45.     }
  46.     }
  47.  
  48.  
  49.     let orderPrice = price*orderCount;
  50.  
  51.  
  52.     if(deliveryType === "With delivery"){
  53.         orderPrice += 60;
  54.     }
  55.  
  56.     if(orderCount > 99){
  57.         orderPrice *= 0.96
  58.     }
  59.     console.log(`${orderPrice.toFixed(2)} BGN`);
  60. }
  61. aluminumJoinery(["2"
  62. ,
  63. "130X180"
  64. ,
  65. "With delivery"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement