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