Advertisement
Guest User

Untitled

a guest
Feb 6th, 2020
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.  
  3.     let w = Number(input.shift());
  4.     let h = Number(input.shift());
  5.     let d = Number(input.shift());
  6.     let ticket = input.shift();
  7.  
  8.     let volumeLuggage = w * h * d;
  9.     tax = 0;
  10.  
  11.  
  12.     if (volumeLuggage >= 50 && volumeLuggage <= 100) {
  13.         if (ticket === "priority") {
  14.             tax = 25;
  15.         }
  16.     } else if (volumeLuggage >= 100 && volumeLuggage <= 200) {
  17.         if (ticket === "priority") {
  18.             tax = 10;
  19.         } else {
  20.             tax = 50;
  21.         }
  22.     } else if (volumeLuggage >= 200 && volumeLuggage <= 300) {
  23.         if (ticket == "priority") {
  24.             tax = 20;
  25.         } else {
  26.             tax = 100;
  27.         }
  28.  
  29.     }
  30.  
  31.     console.log(`Luggage tax: ${tax.toFixed(2)}`);
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement