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