Advertisement
Guest User

LuggageTax

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