Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function aluminumJoinery(input){
- let orderCount = Number(input[0]);
- let orderType = input[1];
- let deliveryType = input[2];
- let price = 0;
- if(orderCount <=10){
- console.log("Invalid order");
- return;
- }else if(orderCount >10){
- switch(orderType){
- case "90X130":
- price = 110;
- if(orderCount > 60){
- price *= 0.92;
- }else if(orderCount > 30){
- price *= 0.95;
- }
- break;
- case "100X150":
- price = 140;
- if(orderCount > 80){
- price *= 0.90;
- }else if(orderCount >40){
- price *= 0.94;
- }
- break;
- case "130X180":
- price = 190;
- if(orderCount > 50){
- price *= 0.88;
- }else if(orderCount > 20){
- price *= 0.93;
- }
- break;
- case "200X300":
- price = 250;
- if(orderCount > 50){
- price *= 0.91;
- }else if(orderCount > 25){
- price *= 0.86;
- }
- break;
- }
- }
- let orderPrice = price*orderCount;
- if(deliveryType === "With delivery"){
- orderPrice += 60;
- }
- if(orderCount > 99){
- orderPrice *= 0.96
- }
- console.log(`${orderPrice.toFixed(2)} BGN`);
- }
- aluminumJoinery(["2"
- ,
- "130X180"
- ,
- "With delivery"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement