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