Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function firsDemoProject(input) {
- let count = Number(input[0]);
- let delivery = input[2];
- let sum = 0;
- if (count >= 10) {
- // I
- if (input[1] == '90X130') {
- count = input[0] * 110;
- if (input[0] >= 10 && input[0] <= 30) {
- sum = count;
- } else if (input[0] > 30 && input[0] <= 60) {
- sum = count - (count * (5 / 100));
- } else if (input[0] > 60) {
- sum = count - (count * (8 / 100));
- }
- // II
- } else if (input[1] == '100X150') {
- count = input[0] * 140;
- if (input[0] >= 10 && input[0] <= 40) {
- sum = count;
- } else if (input[0] > 40 && input[0] <= 80) {
- sum = count - (count * (6 / 100));
- } else if (input[0] > 80) {
- sum = count - (count * (10 / 100));
- }
- }
- // III
- else if (input[1] == '130X180') {
- count = input[0] * 190;
- if (input[0] >= 10 && input[0] <= 20) {
- sum = count;
- } else if (input[0] > 20 && input[0] <= 50) {
- sum = count - (count * (7 / 100));
- console.log(sum);
- } else if (input[0] > 50) {
- sum = count - (count * (12 / 100));
- }
- }
- else if (input[1] == '200X300') {
- count = input[0] * 250;
- if (input[0] >= 10 && input[0] <= 25) {
- sum = count;
- } else if (input[0] > 25 && input[0] <= 50) {
- sum = count - (count * (9 / 100));
- } else if (input[0] > 50) {
- sum = count - (count * (14 / 100));
- }
- }
- }
- //
- if (input[0] >= 10 && input[0] <= 99) {
- if (delivery == 'Without delivery') {
- console.log(`${sum.toFixed(2)} BGN`);
- } else if (delivery == 'With delivery') {
- sum = sum + 60;
- console.log(`${sum.toFixed(2)} BGN`);
- }
- } else if (input[0] >= 10 && input[0] > 99) {
- if (delivery == 'Without delivery') {
- let sum2 = sum - (sum * (4 / 100));
- console.log(`${sum2.toFixed(2)} BGN`);
- } else if (delivery == 'With delivery') {
- sum = sum + 60;
- let sum2 = sum - (sum * (4 / 100));
- console.log(`${sum2.toFixed(2)} BGN`);
- }
- } else {
- console.log('Invalid order');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement